/*!
 * Tipped - The jQuery Tooltip - v2.5.6
 * (c) 2010-2012 Nick Stakenburg
 *
 * http://projects.nickstakenburg.com/tipped
 *
 * License: http://projects.nickstakenburg.com/tipped/license
 */
;var Tipped = { version: '2.5.6' };

Tipped.Skins = {
  // base skin, don't modify! (create custom skins in a seperate file)
  'base': {
    afterUpdate: false,
    ajax: {
      cache: true,
      type: 'get'
    },
    background: {
      color: '#f2f2f2',
      opacity: 1
    },
    border: {
      size: 1,
      color: '#000',
      opacity: 1
    },
    closeButtonSkin: 'default',
    containment: {
      selector: 'viewport'
    },
    fadeIn: 180,
    fadeOut: 220,
    showDelay: 75,
    hideDelay: 25,
    radius: {
      size: 3,
      position: 'background'
    },
    hideAfter: false,
    hideOn: {
      element: 'self',
      event: 'mouseleave'
    },
    hideOthers: false,
    hook: 'topleft',
    inline: false,
    offset: {
      x: 0, y: 0,
      mouse: { x: -12, y: -12 } // only defined in the base class
    },
    onHide: false,
    onShow: false,
    shadow: {
      blur: 2,
      color: '#000',
      offset: { x: 0, y: 0 },
      opacity: .15
    },
    showOn: 'mousemove',
    spinner: true,
    stem: {
      height: 6,
      width: 11,
      offset: { x: 5, y: 5 },
      spacing: 2
    },
    target: 'self'
  },
  
  // Every other skin inherits from this one
  'reset': {
    ajax: false,
    closeButton: false,
    hideOn: [{
      element: 'self',
      event: 'mouseleave'
    }, {
      element: 'tooltip',
      event: 'mouseleave'
    }],
    hook: 'topmiddle',
    stem: true
  },

  // Custom skins start here
  'black': {
     background: { color: '#232323', opacity: .9 },
     border: { size: 1, color: "#232323" },
     spinner: { color: '#fff' }
  },

  'cloud': {
    border: {
      size: 1,
      color: [
        { position: 0, color: '#bec6d5'},
        { position: 1, color: '#b1c2e3' }
      ]
    },
    closeButtonSkin: 'light',
    background: {
      color: [
        { position: 0, color: '#f6fbfd'},
        { position: 0.1, color: '#fff' },
        { position: .48, color: '#fff'},
        { position: .5, color: '#fefffe'},
        { position: .52, color: '#f7fbf9'},
        { position: .8, color: '#edeff0' },
        { position: 1, color: '#e2edf4' }
      ]
    },
    shadow: { opacity: .1 }
  },

  'dark': {
    border: { size: 1, color: '#1f1f1f', opacity: .95 },
    background: {
      color: [
        { position: .0, color: '#686766' },
        { position: .48, color: '#3a3939' },
        { position: .52, color: '#2e2d2d' },
        { position: .54, color: '#2c2b2b' },
        { position: 0.95, color: '#222' },
        { position: 1, color: '#202020' }
      ],
      opacity: .9
    },
    radius: { size: 4 },
    shadow: { offset: { x: 0, y: 1 } },
    spinner: { color: '#ffffff' }
  },

  'facebook': {
    background: { color: '#282828' },
    border: 0,
    fadeIn: 0,
    fadeOut: 0,
    radius: 0,
    stem: {
      width: 7,
      height: 4,
      offset: { x: 6, y: 6 }
    },
    shadow: false
  },

  'lavender': {
    background: {
      color: [
        { position: .0, color: '#b2b6c5' },
        { position: .5, color: '#9da2b4' },
        { position: 1, color: '#7f85a0' }
      ]
    },
    border: {
      color: [
        { position: 0, color: '#a2a9be' },
        { position: 1, color: '#6b7290' }
      ],
      size: 1
    },
    radius: 1,
    shadow: { opacity: .1 }
  },

  'light': {
    border: { size: 0, color: '#afafaf' },
    background: {
      color: [
        { position: 0, color: '#fefefe' },
        { position: 1, color: '#f7f7f7' }
      ]
    },
    closeButtonSkin: 'light',
    radius: 1,
    stem: {
      height: 7,
      width: 13,
      offset: { x: 7, y: 7 }
    },
    shadow: { opacity: .32, blur: 2 }
  },

  'lime': {
    border: {
      size: 1,
      color: [
        { position: 0,   color: '#5a785f' },
        { position: .05, color: '#0c7908' },
        { position: 1, color: '#587d3c' }
      ]
    },
    background: {
      color: [
        { position: 0,   color: '#a5e07f' },
        { position: .02, color: '#cef8be' },
        { position: .09, color: '#7bc83f' },
        { position: .35, color: '#77d228' },
        { position: .65, color: '#85d219' },
        { position: .8,  color: '#abe041' },
        { position: 1,   color: '#c4f087' }
      ]
    }
  },

  'liquid' : {
    border: {
      size: 1,
      color: [
        { position: 0, color: '#454545' },
        { position: 1, color: '#101010' }
      ]
    },
    background: {
      color: [
        { position: 0, color: '#515562'},
        { position: .3, color: '#252e43'},
        { position: .48, color: '#111c34'},
        { position: .52, color: '#161e32'},
        { position: .54, color: '#0c162e'},
        { position: 1, color: '#010c28'}
      ],
      opacity: .8
    },
    radius: { size: 4 },
    shadow: { offset: { x: 0, y: 1 } },
    spinner: { color: '#ffffff' }
  },

  'blue': {
    border: {
      color: [
        { position: 0, color: '#113d71'},
        { position: 1, color: '#1e5290' }
      ]
    },
    background: {
      color: [
        { position: 0, color: '#3a7ab8'},
        { position: .48, color: '#346daa'},
        { position: .52, color: '#326aa6'},
        { position: 1, color: '#2d609b' }
      ]
    },
    spinner: { color: '#f2f6f9' },
    shadow: { opacity: .2 }
  },

  'salmon' : {
    background: {
      color: [
        { position: 0, color: '#fbd0b7' },
        { position: .5, color: '#fab993' },
        { position: 1, color: '#f8b38b' }
      ]
    },
    border: {
      color: [
        { position: 0, color: '#eda67b' },
        { position: 1, color: '#df946f' }
      ],
      size: 1
    },
    radius: 1,
    shadow: { opacity: .1 }
  },

  'yellow': {
    border: { size: 1, color: '#f7c735' },
    background: '#ffffaa',
    radius: 1,
    shadow: { opacity: .1 }
  }
};

Tipped.Skins.CloseButtons = {
  'base': {
    diameter: 17,
    border: 2,
    x: { diameter: 10, size: 2, opacity: 1 },
    states: {
      'default': {
        background: {
          color: [
            { position: 0, color: '#1a1a1a' },
            { position: 0.46, color: '#171717' },
            { position: 0.53, color: '#121212' },
            { position: 0.54, color: '#101010' },
            { position: 1, color: '#000' }
          ],
          opacity: 1
        },
        x: { color: '#fafafa', opacity: 1 },
        border: { color: '#fff', opacity: 1 }
      },
      'hover': {
        background: {
          color: '#333',
          opacity: 1
        },
        x: { color: '#e6e6e6', opacity: 1 },
        border: { color: '#fff', opacity: 1 }
      }
    },
    shadow: {
      blur: 2,
      color: '#000',
      offset: { x: 0, y: 0 },
      opacity: .3
    }
  },

  'reset': {},

  'default': {},

  'light': {
    diameter: 17,
    border: 2,
    x: { diameter: 10, size: 2, opacity: 1 },
    states: {
      'default': {
        background: {
          color: [
            { position: 0, color: '#797979' },
            { position: 0.48, color: '#717171' },
            { position: 0.52, color: '#666' },
            { position: 1, color: '#666' }
          ],
          opacity: 1
        },
        x: { color: '#fff', opacity: .95 },
        border: { color: '#676767', opacity: 1 }
      },
      'hover': {
        background: {
          color: [
            { position: 0, color: '#868686' },
            { position: 0.48, color: '#7f7f7f' },
            { position: 0.52, color: '#757575' },
            { position: 1, color: '#757575' }
          ],
          opacity: 1
        },
        x: { color: '#fff', opacity: 1 },
        border: { color: '#767676', opacity: 1 }
      }
    }
  }
};

(function(O) {
    var P;
    function j(p, f) {
        var q = [p, f];
        q.left = p;
        q.top = f;
        return q
    }
    function ai(f) {
        this.element = f
    }
    function aL(p) {
        var f = {},
        q;
        for (q in p) {
            f[q] = p[q] + "px"
        }
        return f
    }
    function ac(f) {
        return 180 * f / Math.PI
    }
    function aN(f) {
        return f * Math.PI / 180
    }
    function i(p) {
        if (p) {
            this.element = p;
            S.remove(p);
            var f = this.getTooltip();
            this.options = O.extend({},
            f.options);
            this._globalAlpha = 1;
            this._cache = {};
            this.uid = O(p).data("tipped-uid");
            S.add(this);
            this._hookPosition = this.options.hook.tooltip;
            this._stemPosition = this.options.stem && this._hookPosition;
            this.build()
        }
    }
    function g(p, f, q) {
        if ((this.element = p) && f) {
            this.options = O.extend({
                blur: 3,
                offset: {
                    x: 0,
                    y: 0
                },
                color: "#000",
                opacity: 0.5,
                globalAlpha: 1
            },
            q || {}),
            this._globalAlpha = this.options.globalAlpha,
            this._cache = {},
            this.uid = O(p).data("tipped-uid"),
            T.add(this),
            this.build()
        }
    }
    function e(p, f) {
        if (this.element = p) {
            this.options = O.extend({
                blur: 5,
                offset: {
                    x: 0,
                    y: 0
                },
                color: "#000",
                opacity: 0.5,
                globalAlpha: 1
            },
            f || {}),
            this._globalAlpha = this.options.globalAlpha,
            this.uid = O(p).data("tipped-uid"),
            c.add(this),
            this.build()
        }
    }
    function aF(p, f) {
        for (var q in f) {
            f[q] && f[q].constructor && f[q].constructor === Object ? (p[q] = O.extend({},
            p[q]) || {},
            aF(p[q], f[q])) : p[q] = f[q]
        }
        return p
    }
    function ab(p, f, r) {
        if (this.element = p) {
            var q = O(p).data("tipped-uid");
            q && aO.remove(p);
            q = ay();
            O(p).data("tipped-uid", q);
            this.uid = q;
            "object" == O.type(f) && !aM.isElement(f) ? (r = f, f = null) : r = r || {};
            this.options = aO.createOptions(r);
            r = p.getAttribute("title");
            f || ((q = p.getAttribute("data-tipped")) ? f = q: r && (f = r));
            r && (O(p).data("tipped_restore_title", r), p.setAttribute("title", ""));
            this.content = f;
            this.zIndex = this.options.zIndex || +aO.options.startingZIndex;
            this._cache = {
                contentDimensions: {
                    width: 1,
                    height: 1
                },
                events: [],
                timers: [],
                states: {
                    active: !1,
                    xhr: !1,
                    visible: !1,
                    updated: !1,
                    build: !1,
                    skinned: !1,
                    toggles: !1,
                    preloading_images: !1
                },
                fnCallContent: ""
            };
            p = this.options.target;
            this.target = "mouse" == p ? "mouse": "self" == p || !p ? this.element: p && document.getElementById(p) || this.element;
            this._preBuild();
            aO.add(this)
        }
    }
    var u = Array.prototype.slice,
    aM = {
        wrap: function(p, f) {
            return function() {
                var q = [O.proxy(p, this)].concat(u.call(arguments));
                return f.apply(this, q)
            }
        },
        isElement: function(f) {
            return f && 1 == f.nodeType
        },
        delay: function(p, f) {
            var q = u.call(arguments, 2);
            return setTimeout(function() {
                return p.apply(p, q)
            },
            f)
        },
        defer: function(f) {
            return aM.delay.apply(this, [f, 1].concat(u.call(arguments, 1)))
        },
        pointer: function(f) {
            return {
                x: f.pageX,
                y: f.pageY
            }
        },
        element: {
            cumulativeScrollOffset: function(p) {
                var f = 0,
                q = 0;
                do {
                    f += p.scrollTop || 0, q += p.scrollLeft || 0, p = p.parentNode
                } while ( p );
                return j(q, f)
            },
            cumulativeOffset: function(p) {
                var f = O(p).offset(),
                p = aM.element.cumulativeScrollOffset(p),
                r = O(window).scrollTop(),
                q = O(window).scrollLeft();
                f.left += p.left - q;
                f.top += p.top - r;
                return j(f.left, f.top)
            },
            isAttached: function(f) {
                for (; f && f.parentNode;) {
                    f = f.parentNode
                }
                return ! (!f || !f.body)
            }
        }
    },
    an = navigator.userAgent,
    W = function(f) {
        return (f = RegExp(f + "([\\d.]+)").exec(an)) ? parseFloat(f[1]) : !0
    };
    P = !!(window.attachEvent && -1 === an.indexOf("Opera")) && W("MSIE "); - 1 < an.indexOf("Opera") && window.opera && opera.version && parseFloat(opera.version()); - 1 < an.indexOf("AppleWebKit/") && W("AppleWebKit/"); - 1 < an.indexOf("Gecko") && -1 === an.indexOf("KHTML") && W("rv:");
    an.match(/Apple.*Mobile.*Safari/); - 1 < an.indexOf("Chrome") && W("Chrome/");
    var Q = function(p) {
        for (var f = (p = p.match(h)) && p[1] && p[1].split(".") || [], s = 0, q = 0, r = f.length; q < r; q++) {
            s += parseInt(f[q] * Math.pow(10, 6 - 2 * q))
        }
        return p && p[3] ? s - 1 : s
    },
    h = /^(\d+(\.?\d+){0,3})([A-Za-z_-]+[A-Za-z0-9]+)?/,
    aI = {
        scripts: {
            jQuery: {
                required: "1.4.4",
                available: window.jQuery && jQuery.fn.jquery
            }
        },
        check: function(f) {
            if (!this.scripts[f].checked && (this.scripts[f].checked = !0, !this.scripts[f].available || Q(this.scripts[f].available) < Q(this.scripts[f].required) && !this.scripts[f].notified)) {
                if (this.scripts[f].notified = !0, f = "Tipped requires " + f + " >= " + this.scripts[f].required, window.console) {
                    console[console.warn ? "warn": "log"](f)
                } else {
                    alert(f)
                }
            }
        }
    },
    ay,
    af = 0;
    ay = function(f) {
        f = f || "_t_uid_";
        for (af++; document.getElementById(f + af);) {
            af++
        }
        return f + af
    };
    O.extend(Tipped, {
        support: {
            canvas: function() {
                var f = document.createElement("canvas");
                return ! (!f.getContext || !f.getContext("2d"))
            } (),
            touch: function() {
                try {
                    return !! ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch)
                } catch(f) {
                    return ! 1
                }
            } (),
            cssTransitions: function() {
                var f = !1;
                O.each(["WebKitTransitionEvent", "TransitionEvent", "OTransitionEvent"],
                function(p, r) {
                    try {
                        document.createEvent(r),
                        f = !0
                    } catch(q) {}
                });
                return f
            } ()
        },
        init: function() {
            if (!this.support.canvas && !window.G_vmlCanvasManager) {
                if (P) {
                    //alert("Tipped requires ExplorerCanvas (excanvas.js)")
                } else {
                    return
                }
            }
            aI.check("jQuery");
            O(document).ready(function() {
                aO.startDelegating()
            })
        },
        create: function(p, f, q) {
            ai.create(p, f, q);
            return this.get(p)
        },
        get: function(f) {
            return new ai(f)
        },
        findElement: function(f) {
            return aO.findElement(f)
        },
        show: function(f) {
            this.get(f).show();
            return this
        },
        hide: function(f) {
            this.get(f).hide();
            return this
        },
        toggle: function(f) {
            this.get(f).toggle();
            return this
        },
        refresh: function(f) {
            this.get(f).refresh();
            return this
        },
        remove: function(f) {
            this.get(f).remove();
            return this
        },
        hideAll: function() {
            aO.hideAll();
            return this
        },
        setDefaultSkin: function(f) {
            aO.setDefaultSkin(f);
            return this
        },
        setStartingZIndex: function(f) {
            aO.setStartingZIndex(f);
            return this
        },
        visible: function(p) {
            if (aM.isElement(p)) {
                return aO.isVisibleByElement(p)
            }
            if ("undefined" != O.type(p)) {
                var p = O(p),
                f = 0;
                O.each(p,
                function(q, r) {
                    aO.isVisibleByElement(r) && f++
                });
                return f
            }
            return aO.getVisible().length
        }
    });
    O.extend(ai, {
        create: function(p, f, s) {
            if (p) {
                var q = s || {},
                r = [];
                aO.removeDetached();
                aM.isElement(p) ? r.push(new ab(p, f, q)) : O(p).each(function(t, v) {
                    r.push(new ab(v, f, q))
                });
                return r
            }
        }
    });
    O.extend(ai.prototype, {
        items: function() {
            aO.Position.mouseBuffer = {
                x: 0,
                y: 0
            };
            return aO.get(this.element)
        },
        show: function() {
            O.each(this.items(),
            function(p, f) {
                f.show()
            });
            return this
        },
        hide: function() {
            O.each(this.items(),
            function(p, f) {
                f.hide()
            });
            return this
        },
        toggle: function() {
            O.each(this.items(),
            function(p, f) {
                f.toggle()
            });
            return this
        },
        refresh: function() {
            O.each(this.items(),
            function(p, f) {
                f.refresh()
            });
            return this
        },
        remove: function() {
            aO.remove(this.element);
            return this
        }
    });
    W = window.G_vmlCanvasManager && !Tipped.support.canvas && P ?
    function(f) {
        G_vmlCanvasManager.initElement(f)
    }: function() {};
    var R = {
        init: W,
        drawRoundedRectangle: function(p, f) {
            var v = O.extend({
                top: 0,
                left: 0,
                width: 0,
                height: 0,
                radius: 0
            },
            f || {}),
            s = v.left,
            t = v.top,
            q = v.width,
            r = v.height; (v = v.radius) ? (p.beginPath(), p.moveTo(s + v, t), p.arc(s + q - v, t + v, v, aN( - 90), aN(0), !1), p.arc(s + q - v, t + r - v, v, aN(0), aN(90), !1), p.arc(s + v, t + r - v, v, aN(90), aN(180), !1), p.arc(s + v, t + v, v, aN( - 180), aN( - 90), !1), p.closePath(), p.fill()) : p.fillRect(s, t, q, r)
        },
        drawPixelArray: function(p, f, w) {
            for (var w = O.extend({
                x: 0,
                y: 0,
                color: "#000"
            },
            w || {}), t = 0, v = f.length; t < v; t++) {
                for (var q = 0,
                r = f[t].length; q < r; q++) {
                    var s = parseInt(f[t].charAt(q)) * (1 / 9);
                    p.fillStyle = aq.hex2fill(w.color, s);
                    s && p.fillRect(w.x + q, w.y + t, 1, 1)
                }
            }
        },
        createFillStyle: function(p, f, r) {
            var q;
            "string" == O.type(f) ? q = aq.hex2fill(f) : "string" == O.type(f.color) ? q = aq.hex2fill(f.color, "number" == O.type(f.opacity) ? f.opacity: 1) : O.isArray(f.color) && (r = O.extend({
                x1: 0,
                y1: 0,
                x2: 0,
                y2: 0
            },
            r || {}), q = R.Gradient.addColorStops(p.createLinearGradient(r.x1, r.y1, r.x2, r.y2), f.color, f.opacity));
            return q
        },
        Gradient: {
            addColorStops: function(p, f, t) {
                for (var t = "number" == O.type(t) ? t: 1, r = 0, s = f.length; r < s; r++) {
                    var q = f[r];
                    if ("undefined" == O.type(q.opacity) || "number" != O.type(q.opacity)) {
                        q.opacity = 1
                    }
                    p.addColorStop(q.position, aq.hex2fill(q.color, q.opacity * t))
                }
                return p
            }
        }
    },
    ax = {
        top: "height",
        left: "width",
        bottom: "height",
        right: "width"
    },
    aK = {
        positions: "topleft topmiddle topright righttop rightmiddle rightbottom bottomright bottommiddle bottomleft leftbottom leftmiddle lefttop".split(" "),
        regex: {
            toOrientation: /^(top|left|bottom|right)(top|left|bottom|right|middle|center)$/,
            horizontal: /^(top|bottom)/,
            isCenter: /(middle|center)/,
            side: /^(top|bottom|left|right)/
        },
        toDimension: function(f) {
            return ax[f]
        },
        isCenter: function(f) {
            return !! f.toLowerCase().match(this.regex.isCenter)
        },
        isCorner: function(f) {
            return ! this.isCenter(f)
        },
        getOrientation: function(f) {
            return f.toLowerCase().match(this.regex.horizontal) ? "horizontal": "vertical"
        },
        getSide: function(p) {
            var f = null; (p = p.toLowerCase().match(this.regex.side)) && p[1] && (f = p[1]);
            return f
        },
        split: function(f) {
            return f.toLowerCase().match(this.regex.toOrientation)
        }
    },
    ae = {
        getDimensions: function(f) {
            f = f.options.stem;
            return {
                width: f.width,
                height: f.height
            }
        },
        getBorderDimensions: function(p, f, q) {
            q = O.extend({
                math: "ceil"
            },
            q || {});
            p = p.options.stem;
            f = this.getCenterBorderDimensions(p.width, p.height, f);
            q.math && (f.width = Math[q.math](f.width), f.height = Math[q.math](f.height));
            return {
                width: f.width,
                height: f.height
            }
        },
        getCenterBorderDimensions: function(p, f, r) {
            var q = 180 - ac(Math.atan(0.5 * (f / p))),
            r = Math.cos(aN(q - 90)) * r,
            r = p + 2 * r;
            return {
                width: r,
                height: r * f / p
            }
        },
        getLayout: function(p, f) {
            var s = this.getBorderDimensions(p, f),
            q = this.getDimensions(p);
            aK.isCenter(p._hookPosition);
            var r = Math.ceil(s.height + f);
            return {
                box: {
                    dimensions: {
                        width: Math.ceil(s.width),
                        height: Math.ceil(r)
                    }
                },
                border: {
                    dimensions: s
                },
                stem: {
                    dimensions: {
                        width: q.width,
                        height: q.height
                    }
                }
            }
        },
        getBubbleLayout: function(C, B, A) {
            var y = C.options,
            z = {
                top: 0,
                left: 0
            },
            s = {
                top: 0,
                left: 0
            },
            t = O.extend({},
            B),
            w = C.border,
            f = f || this.getLayout(C, C.border),
            p = f.box.dimensions;
            A && (p.height = A, w = 0);
            if (C.options.stem) {
                var r = aK.getSide(C._hookPosition);
                "top" == r ? z.top = p.height - w: "left" == r && (z.left = p.height - w);
                var A = aK.split(C._hookPosition),
                D = aK.getOrientation(C._hookPosition);
                if ("horizontal" == D) {
                    switch (A[2]) {
                    case "middle":
                    case "center":
                        s.left = 0.5 * t.width;
                        break;
                    case "right":
                        s.left = t.width
                    }
                    "bottom" == A[1] && (s.top = t.height - w + p.height)
                } else {
                    switch (A[2]) {
                    case "middle":
                    case "center":
                        s.top = 0.5 * t.height;
                        break;
                    case "bottom":
                        s.top = t.height
                    }
                    "right" == A[1] && (s.left = t.width - w + p.height)
                }
                t[aK.toDimension(r)] += p.height - w
            } else {
                if (A = aK.split(C._hookPosition), D = aK.getOrientation(C._hookPosition), "horizontal" == D) {
                    switch (A[2]) {
                    case "middle":
                    case "center":
                        s.left = 0.5 * t.width;
                        break;
                    case "right":
                        s.left = t.width
                    }
                    "bottom" == A[1] && (s.top = t.height)
                } else {
                    switch (A[2]) {
                    case "middle":
                    case "center":
                        s.top = 0.5 * t.height;
                        break;
                    case "bottom":
                        s.top = t.height
                    }
                    "right" == A[1] && (s.left = t.width)
                }
            }
            r = y.radius && y.radius.size || 0;
            w = y.border && y.border.size || 0;
            if (C.options.stem) {
                var q = y.stem && y.stem.offset || {
                    x: 0,
                    y: 0
                },
                C = r && "background" == y.radius.position ? r: 0,
                r = r && "border" == y.radius.position ? r: r + w,
                v = w + C + 0.5 * f.stem.dimensions.width - 0.5 * f.border.dimensions.width,
                f = Math.ceil(w + C + 0.5 * f.stem.dimensions.width + (r > v ? r - v: 0));
                if ("horizontal" == D) {
                    switch (A[2]) {
                    case "left":
                        s.left += f;
                        break;
                    case "right":
                        s.left -= f
                    }
                } else {
                    switch (A[2]) {
                    case "top":
                        s.top += f;
                        break;
                    case "bottom":
                        s.top -= f
                    }
                }
            }
            if (y.stem && (q = y.stem.offset)) {
                if ("horizontal" == D) {
                    switch (A[2]) {
                    case "left":
                        s.left += q.x;
                        break;
                    case "right":
                        s.left -= q.x
                    }
                } else {
                    switch (A[2]) {
                    case "top":
                        s.top += q.y;
                        break;
                    case "bottom":
                        s.top -= q.y
                    }
                }
            }
            var x;
            if (y.stem && (x = y.stem.spacing)) {
                if ("horizontal" == D) {
                    switch (A[1]) {
                    case "top":
                        s.top -= x;
                        break;
                    case "bottom":
                        s.top += x
                    }
                } else {
                    switch (A[1]) {
                    case "left":
                        s.left -= x;
                        break;
                    case "right":
                        s.left += x
                    }
                }
            }
            return {
                dimensions: t,
                position: {
                    top: 0,
                    left: 0
                },
                background: {
                    position: z,
                    dimensions: B
                },
                stem: {
                    dimensions: p
                },
                anchor: s
            }
        }
    },
    aq,
    aQ = function(f) {
        f.red = f[0];
        f.green = f[1];
        f.blue = f[2];
        return f
    },
    o = function(p) {
        var f = Array(3);
        0 == p.indexOf("#") && (p = p.substring(1));
        p = p.toLowerCase();
        if ("" != p.replace(l, "")) {
            return null
        }
        3 == p.length ? (f[0] = p.charAt(0) + p.charAt(0), f[1] = p.charAt(1) + p.charAt(1), f[2] = p.charAt(2) + p.charAt(2)) : (f[0] = p.substring(0, 2), f[1] = p.substring(2, 4), f[2] = p.substring(4));
        for (p = 0; p < f.length; p++) {
            f[p] = parseInt(f[p], 16)
        }
        return aQ(f)
    },
    l = RegExp("[0123456789abcdef]", "g");
    aq = {
        hex2rgb: o,
        hex2fill: function(p, f) {
            "undefined" == O.type(f) && (f = 1);
            var r = f,
            q = o(p);
            q[3] = r;
            q.opacity = r;
            return "rgba(" + q.join() + ")"
        },
        getSaturatedBW: function(y) {
            var y = o(y),
            y = aQ(y),
            x = y.red,
            w = y.green,
            t = y.blue,
            v,
            s = x > w ? x: w;
            t > s && (s = t);
            var q = x < w ? x: w;
            t < q && (q = t);
            v = s / 255;
            y = 0 != s ? (s - q) / s: 0;
            if (0 == y) {
                x = 0
            } else {
                var r = (s - x) / (s - q),
                p = (s - w) / (s - q),
                t = (s - t) / (s - q),
                x = (x == s ? t - p: w == s ? 2 + r - t: 4 + p - r) / 6;
                0 > x && (x += 1)
            }
            x = Math.round(360 * x);
            y = Math.round(100 * y);
            v = Math.round(100 * v);
            w = [];
            w[0] = x;
            w[1] = y;
            w[2] = v;
            w.hue = x;
            w.saturation = y;
            w.brightness = v;
            return "#" + (50 < w[2] ? "000": "fff")
        }
    };
    var S = {
        skins: {},
        get: function(p) {
            if (!p) {
                return null
            }
            var f = null; (p = O(p).data("tipped-uid")) && (f = this.skins[p]);
            return f
        },
        add: function(f) {
            this.skins[f.uid] = f
        },
        remove: function(f) {
            if (f = this.get(f)) {
                delete this.skins[f.uid],
                f.remove()
            }
        }
    };
    O.extend(i.prototype, {
        prepare: function() {
            var f = this.getTooltip();
            this.contentDimensions = f._cache.contentDimensions;
            f = f.options;
            this.radius = f.radius && f.radius.size || 0;
            this.border = f.border && f.border.size || 0;
            this.padding = f.padding;
            f = Math.min(this.contentDimensions.height, this.contentDimensions.width);
            this.radius > f / 2 && (this.radius = Math.floor(f / 2));
            "border" == this.options.radius.position && this.radius > this.border && (this.border = this.radius);
            this._cache = {
                options: {
                    radius: this.radius,
                    border: this.border,
                    padding: this.padding
                }
            }
        },
        createHookCache: function() {
            this._cache.hook = {};
            var f = this._hookPosition;
            O.each(aK.positions, O.proxy(function(p, v) {
                var s, t = this._cache.hook[v] = {};
                this._hookPosition = v;
                s = this.getOrderLayout();
                t.anchor = s.anchor;
                t.bubble = {
                    dimensions: s.bubble.dimensions,
                    position: {
                        top: s.bubble.position.top,
                        left: s.bubble.position.left
                    }
                };
                t.tooltip = {
                    dimensions: s.skin.dimensions
                };
                if (this.shadow) {
                    s = this.shadow.getOrderLayout();
                    var q = s.skin.position,
                    r = t.bubble.position;
                    O.extend(!0, t, {
                        anchor: s.anchor,
                        bubble: {
                            position: {
                                top: r.top + q.top,
                                left: r.left + q.left
                            }
                        },
                        tooltip: {
                            dimensions: s.tooltip.dimensions
                        }
                    })
                }
            },
            this));
            this._hookPosition = f
        },
        build: function() {
            this.cleanup();
            window.G_vmlCanvasManager && window.G_vmlCanvasManager.init_(document);
            var p = this.getTooltip(),
            f = this.options;
            this.bubble = O("<div>").addClass("t_Bubble")[0];
            O(p.skinElement).append(this.bubble);
            this.prepare();
            this.drawBubble(p);
            f.closeButton && (this.drawCloseButton(p), f.closeButton.shadow && (this.closeButtonShadow ? (this.closeButtonShadow.options = f.closeButton.shadow, this.closeButtonShadow.build()) : this.closeButtonShadow = new e(this.element, O.extend({
                globalAlpha: this._globalAlpha
            },
            f.closeButton.shadow))));
            P && 7 > P && O(p.container).prepend(this.iframeShim = O("<iframe>").addClass("t_iframeShim").attr({
                frameBorder: 0,
                src: "javascript:'';"
            }));
            this.order();
            f.shadow && (this.shadow ? (this.shadow.options = f.shadow, this.shadow.build()) : this.shadow = new g(this.element, this, O.extend({
                globalAlpha: this._globalAlpha
            },
            f.shadow)));
            this.createHookCache()
        },
        remove: function() {
            this.cleanup();
            this.options.shadow && (T.remove(this.element), this.options.closeButton && this.options.closeButton.shadow && c.remove(this.element));
            this.iframeShim && (this.iframeShim.remove(), this.iframeShim = null);
            this.container && (O(this.container).remove(), this.container = null)
        },
        cleanup: function() {
            this.bubble && (this.closeButton && (O(this.closeButton).remove(), this.hoverCloseButton = this.defaultCloseButton = this.closeButton = null), O(this.bubble).remove(), this.bubble = this.background = this.stem = null, this._cache = {})
        },
        getTooltip: function() {
            return aO.get(this.element)[0]
        },
        refresh: function() {
            var p = this.getTooltip(),
            f = O(p.container),
            v = O(p.container).find(".t_ContentContainer").first()[0];
            if (v) {
                O(v).css({
                    width: "auto",
                    height: "auto"
                });
                var s = parseInt(f.css("top")),
                t = parseInt(f.css("left")),
                q = parseInt(f.css("width"));
                f.css({
                    left: "-25000px",
                    top: "-25000px",
                    width: "15000px",
                    height: "auto"
                });
                p.getState("visible") || O(p.container).show();
                var r = aO.UpdateQueue.getMeasureElementDimensions(v);
                p.options.maxWidth && ("number" == O.type(p.options.maxWidth) && r.width > p.options.maxWidth) && (O(v).css({
                    width: p.options.maxWidth + "px"
                }), r = aO.UpdateQueue.getMeasureElementDimensions(v));
                p.getState("visible") || O(p.container).hide();
                p._cache.contentDimensions = r;
                f.css({
                    left: t + "px",
                    top: s + "px",
                    width: q + "px"
                });
                this.build()
            }
        },
        setHookPosition: function(f) {
            this._hookPosition != f && (this._hookPosition = f, this.build())
        },
        drawCloseButton: function(p) {
            var f = p.options.closeButton,
            f = {
                width: f.diameter + 2 * f.border,
                height: f.diameter + 2 * f.border
            };
            O(p.container).append(O(this.closeButton = document.createElement("div")).addClass("t_Close").css(aL(f)).append(O(this.closeButtonShift = document.createElement("div")).addClass("t_CloseButtonShift").css(aL(f))));
            this.drawCloseButtonState(p, "default");
            this.drawCloseButtonState(p, "hover");
            Tipped.support.touch || O(this.closeButton).bind("mouseenter", O.proxy(this.closeButtonMouseover, this)).bind("mouseleave", O.proxy(this.closeButtonMouseout, this))
        },
        drawCloseButtonState: function(y, x) {
            var w = y.options.closeButton,
            t = w.diameter,
            v = w.border || 0,
            q = w.x.diameter,
            r = w.x.size,
            s = w.states[x || "default"],
            f = {
                width: t + 2 * v,
                height: t + 2 * v
            };
            q >= t && (q = t - 2);
            var p;
            O(this.closeButtonShift).append(O(this[x + "CloseButton"] = document.createElement("div")).addClass("t_CloseState").css(O.extend(aL(f), {
                left: ("hover" == x ? f.width: 0) + "px"
            })));
            O(document.body).append(O(p = document.createElement("canvas")).attr(f));
            R.init(p);
            w = p.getContext("2d");
            w.globalAlpha = this._globalAlpha;
            O(this[x + "CloseButton"]).append(p);
            w.translate(f.width / 2, f.height / 2);
            w.fillStyle = R.createFillStyle(w, s.background, {
                x1: 0,
                y1: 0 - t / 2,
                x2: 0,
                y2: 0 + t / 2
            });
            w.beginPath();
            w.arc(0, 0, t / 2, 0, 2 * Math.PI, !0);
            w.closePath();
            w.fill();
            v && (w.fillStyle = R.createFillStyle(w, s.border, {
                x1: 0,
                y1: 0 - t / 2 - v,
                x2: 0,
                y2: 0 + t / 2 + v
            }), w.beginPath(), w.arc(0, 0, t / 2, Math.PI, 0, !1), w.lineTo((t + v) / 2, 0), w.arc(0, 0, t / 2 + v, 0, Math.PI, !0), w.arc(0, 0, t / 2 + v, Math.PI, 0, !0), w.lineTo(t / 2, 0), w.arc(0, 0, t / 2, 0, Math.PI, !1), w.closePath(), w.fill());
            t = q / 2;
            r /= 2;
            r > t && (v = r, r = t, t = v);
            w.fillStyle = aq.hex2fill(s.x.color || s.x, s.x.opacity || 1);
            w.rotate(aN(45));
            w.beginPath();
            w.moveTo(0, 0);
            w.lineTo(0, t);
            for (s = 0; 4 > s; s++) {
                w.lineTo(0, t),
                w.lineTo(r, t),
                w.lineTo(r, t - (t - r)),
                w.lineTo(t, r),
                w.lineTo(t, 0),
                w.rotate(aN(90))
            }
            w.closePath();
            w.fill()
        },
        drawBubble: function(x) {
            var w = this.getOrderLayout(),
            v = this.options.stem && this.getStemLayout(),
            s = this._hookPosition && this._hookPosition.toLowerCase(),
            t = this.radius,
            p = this.border,
            x = x.options.stem && x.options.stem.offset || {
                x: 0,
                y: 0
            },
            q = 0,
            r = 0;
            t && (q = "background" == this.options.radius.position ? t: 0, r = "border" == this.options.radius.position ? t: q + p);
            O(document.body).append(this.bubbleCanvas = document.createElement("canvas"));
            O(this.bubbleCanvas).attr(w.bubble.dimensions);
            R.init(this.bubbleCanvas);
            t = this.bubbleCanvas.getContext("2d");
            t.globalAlpha = this._globalAlpha;
            O(this.bubble).append(this.bubbleCanvas);
            t.fillStyle = R.createFillStyle(t, this.options.background, {
                x1: 0,
                y1: w.background.position.top + p,
                x2: 0,
                y2: w.background.position.top + w.background.dimensions.height - p
            });
            t.lineWidth = 0;
            this._drawBackgroundPath(t, {
                beginPath: !0,
                closePath: !0,
                border: p,
                radius: q,
                borderRadius: r,
                layout: w,
                stemLayout: v,
                stem: this.options.stem,
                hookPosition: s,
                cornerOffset: x
            });
            t.fill();
            if (p) {
                var f = R.createFillStyle(t, this.options.border, {
                    x1: 0,
                    y1: w.background.position.top,
                    x2: 0,
                    y2: w.background.position.top + w.background.dimensions.height
                });
                t.fillStyle = f;
                this._drawBackgroundPath(t, {
                    beginPath: !0,
                    closePath: !1,
                    border: p,
                    radius: q,
                    borderRadius: r,
                    layout: w,
                    stemLayout: v,
                    stem: this.options.stem,
                    hookPosition: s,
                    cornerOffset: x
                });
                this._drawBorderPath(t, {
                    beginPath: !1,
                    closePath: !0,
                    border: p,
                    backgroundRadius: q,
                    radius: {
                        size: r,
                        position: this.options.radius.position
                    },
                    layout: w,
                    stemLayout: v,
                    stem: this.options.stem,
                    hookPosition: s,
                    cornerOffset: x
                });
                t.fill()
            }
        },
        _drawBackgroundPath: function(B, A) {
            var z = O.extend({
                stem: !1,
                hookPosition: null,
                beginPath: !1,
                closePath: !1,
                layout: null,
                stemLayout: null,
                radius: 0,
                border: 0,
                borderRadius: 0,
                cornerOffset: {
                    x: 0,
                    y: 0
                }
            },
            A || {}),
            x = z.layout,
            y = z.stemLayout,
            s = z.cornerOffset,
            t = z.border,
            w = z.radius,
            f = z.hookPosition,
            p = x.background.position,
            x = x.background.dimensions,
            r,
            C,
            q;
            y && (r = y.stem.dimensions, C = y.box.dimensions, q = z.borderRadius, y = t + w + 0.5 * r.width - 0.5 * y.border.dimensions.width, q = Math.ceil(q > y ? q - y: 0));
            var v, y = w ? p.left + t + w: p.left + t;
            v = p.top + t;
            s && (s.x && /^(topleft|lefttop)$/.test(f)) && (y += s.x);
            z.beginPath && B.beginPath();
            B.moveTo(y, v);
            if (z.stem) {
                switch (f) {
                case "topleft":
                    y = p.left + t;
                    w && (y += w);
                    y += Math.max(q, s.x || 0);
                    B.lineTo(y, v);
                    v -= r.height;
                    y += 0.5 * r.width;
                    B.lineTo(y, v);
                    v += r.height;
                    y += 0.5 * r.width;
                    B.lineTo(y, v);
                    break;
                case "topmiddle":
                case "topcenter":
                    y = p.left + 0.5 * x.width - 0.5 * r.width;
                    B.lineTo(y, v);
                    v -= r.height;
                    y += 0.5 * r.width;
                    B.lineTo(y, v);
                    v += r.height;
                    y += 0.5 * r.width;
                    B.lineTo(y, v);
                    y = p.left + 0.5 * x.width - 0.5 * C.width;
                    B.lineTo(y, v);
                    break;
                case "topright":
                    y = p.left + x.width - t - r.width,
                    w && (y -= w),
                    y -= Math.max(q, s.x || 0),
                    B.lineTo(y, v),
                    v -= r.height,
                    y += 0.5 * r.width,
                    B.lineTo(y, v),
                    v += r.height,
                    y += 0.5 * r.width,
                    B.lineTo(y, v)
                }
            }
            w ? w && (B.arc(p.left + x.width - t - w, p.top + t + w, w, aN( - 90), aN(0), !1), y = p.left + x.width - t, v = p.top + t + w) : (y = p.left + x.width - t, v = p.top + t, B.lineTo(y, v));
            if (z.stem) {
                switch (f) {
                case "righttop":
                    v = p.top + t;
                    w && (v += w);
                    v += Math.max(q, s.y || 0);
                    B.lineTo(y, v);
                    y += r.height;
                    v += 0.5 * r.width;
                    B.lineTo(y, v);
                    y -= r.height;
                    v += 0.5 * r.width;
                    B.lineTo(y, v);
                    break;
                case "rightmiddle":
                case "rightcenter":
                    v = p.top + 0.5 * x.height - 0.5 * r.width;
                    B.lineTo(y, v);
                    y += r.height;
                    v += 0.5 * r.width;
                    B.lineTo(y, v);
                    y -= r.height;
                    v += 0.5 * r.width;
                    B.lineTo(y, v);
                    break;
                case "rightbottom":
                    v = p.top + x.height - t,
                    w && (v -= w),
                    v -= r.width,
                    v -= Math.max(q, s.y || 0),
                    B.lineTo(y, v),
                    y += r.height,
                    v += 0.5 * r.width,
                    B.lineTo(y, v),
                    y -= r.height,
                    v += 0.5 * r.width,
                    B.lineTo(y, v)
                }
            }
            w ? w && (B.arc(p.left + x.width - t - w, p.top + x.height - t - w, w, aN(0), aN(90), !1), y = p.left + x.width - t - w, v = p.top + x.height - t) : (y = p.left + x.width - t, v = p.top + x.height - t, B.lineTo(y, v));
            if (z.stem) {
                switch (f) {
                case "bottomright":
                    y = p.left + x.width - t;
                    w && (y -= w);
                    y -= Math.max(q, s.x || 0);
                    B.lineTo(y, v);
                    y -= 0.5 * r.width;
                    v += r.height;
                    B.lineTo(y, v);
                    y -= 0.5 * r.width;
                    v -= r.height;
                    B.lineTo(y, v);
                    break;
                case "bottommiddle":
                case "bottomcenter":
                    y = p.left + 0.5 * x.width + 0.5 * r.width;
                    B.lineTo(y, v);
                    y -= 0.5 * r.width;
                    v += r.height;
                    B.lineTo(y, v);
                    y -= 0.5 * r.width;
                    v -= r.height;
                    B.lineTo(y, v);
                    break;
                case "bottomleft":
                    y = p.left + t + r.width,
                    w && (y += w),
                    y += Math.max(q, s.x || 0),
                    B.lineTo(y, v),
                    y -= 0.5 * r.width,
                    v += r.height,
                    B.lineTo(y, v),
                    y -= 0.5 * r.width,
                    v -= r.height,
                    B.lineTo(y, v)
                }
            }
            w ? w && (B.arc(p.left + t + w, p.top + x.height - t - w, w, aN(90), aN(180), !1), y = p.left + t, v = p.top + x.height - t - w) : (y = p.left + t, v = p.top + x.height - t, B.lineTo(y, v));
            if (z.stem) {
                switch (f) {
                case "leftbottom":
                    v = p.top + x.height - t;
                    w && (v -= w);
                    v -= Math.max(q, s.y || 0);
                    B.lineTo(y, v);
                    y -= r.height;
                    v -= 0.5 * r.width;
                    B.lineTo(y, v);
                    y += r.height;
                    v -= 0.5 * r.width;
                    B.lineTo(y, v);
                    break;
                case "leftmiddle":
                case "leftcenter":
                    v = p.top + 0.5 * x.height + 0.5 * r.width;
                    B.lineTo(y, v);
                    y -= r.height;
                    v -= 0.5 * r.width;
                    B.lineTo(y, v);
                    y += r.height;
                    v -= 0.5 * r.width;
                    B.lineTo(y, v);
                    break;
                case "lefttop":
                    v = p.top + t + r.width,
                    w && (v += w),
                    v += Math.max(q, s.y || 0),
                    B.lineTo(y, v),
                    y -= r.height,
                    v -= 0.5 * r.width,
                    B.lineTo(y, v),
                    y += r.height,
                    v -= 0.5 * r.width,
                    B.lineTo(y, v)
                }
            }
            w ? w && (B.arc(p.left + t + w, p.top + t + w, w, aN( - 180), aN( - 90), !1), y = p.left + t + w, v = p.top + t, y += 1, B.lineTo(y, v)) : (y = p.left + t, v = p.top + t, B.lineTo(y, v));
            z.closePath && B.closePath();
            return {
                x: y,
                y: v
            }
        },
        _drawBorderPath: function(E, D) {
            var C = O.extend({
                stem: !1,
                hookPosition: null,
                beginPath: !1,
                closePath: !1,
                layout: null,
                stemLayout: null,
                radius: 0,
                border: 0,
                stemOffset: 0,
                cornerOffset: {
                    x: 0,
                    y: 0
                }
            },
            D || {}),
            A = C.layout,
            B = C.stemLayout,
            v = C.cornerOffset,
            w = C.border,
            y = C.radius && C.radius.size || 0,
            q = C.backgroundRadius,
            r = C.hookPosition,
            t = A.background.position,
            A = A.background.dimensions,
            F,
            s,
            x;
            B && (F = B.stem.dimensions, s = B.border.dimensions, x = w + q + 0.5 * F.width - 0.5 * s.width, x = Math.ceil(y > x ? y - x: 0));
            var B = t.left + w + q,
            z = t.top + w;
            q && (B += 1);
            O.extend({},
            {
                x: B,
                y: z
            });
            C.beginPath && E.beginPath();
            var f = O.extend({},
            {
                x: B,
                y: z
            }),
            z = z - w;
            E.lineTo(B, z);
            y ? y && (E.arc(t.left + y, t.top + y, y, aN( - 90), aN( - 180), !0), B = t.left, z = t.top + y) : (B = t.left, z = t.top, E.lineTo(B, z));
            if (C.stem) {
                switch (r) {
                case "lefttop":
                    z = t.top + w;
                    q && (z += q);
                    z -= 0.5 * s.width;
                    z += 0.5 * F.width;
                    z += Math.max(x, v.y || 0);
                    E.lineTo(B, z);
                    B -= s.height;
                    z += 0.5 * s.width;
                    E.lineTo(B, z);
                    B += s.height;
                    z += 0.5 * s.width;
                    E.lineTo(B, z);
                    break;
                case "leftmiddle":
                case "leftcenter":
                    z = t.top + 0.5 * A.height - 0.5 * s.width;
                    E.lineTo(B, z);
                    B -= s.height;
                    z += 0.5 * s.width;
                    E.lineTo(B, z);
                    B += s.height;
                    z += 0.5 * s.width;
                    E.lineTo(B, z);
                    break;
                case "leftbottom":
                    z = t.top + A.height - w - s.width,
                    q && (z -= q),
                    z += 0.5 * s.width,
                    z -= 0.5 * F.width,
                    z -= Math.max(x, v.y || 0),
                    E.lineTo(B, z),
                    B -= s.height,
                    z += 0.5 * s.width,
                    E.lineTo(B, z),
                    B += s.height,
                    z += 0.5 * s.width,
                    E.lineTo(B, z)
                }
            }
            y ? y && (E.arc(t.left + y, t.top + A.height - y, y, aN( - 180), aN( - 270), !0), B = t.left + y, z = t.top + A.height) : (B = t.left, z = t.top + A.height, E.lineTo(B, z));
            if (C.stem) {
                switch (r) {
                case "bottomleft":
                    B = t.left + w;
                    q && (B += q);
                    B -= 0.5 * s.width;
                    B += 0.5 * F.width;
                    B += Math.max(x, v.x || 0);
                    E.lineTo(B, z);
                    z += s.height;
                    B += 0.5 * s.width;
                    E.lineTo(B, z);
                    z -= s.height;
                    B += 0.5 * s.width;
                    E.lineTo(B, z);
                    break;
                case "bottommiddle":
                case "bottomcenter":
                    B = t.left + 0.5 * A.width - 0.5 * s.width;
                    E.lineTo(B, z);
                    z += s.height;
                    B += 0.5 * s.width;
                    E.lineTo(B, z);
                    z -= s.height;
                    B += 0.5 * s.width;
                    E.lineTo(B, z);
                    B = t.left + 0.5 * A.width + s.width;
                    E.lineTo(B, z);
                    break;
                case "bottomright":
                    B = t.left + A.width - w - s.width,
                    q && (B -= q),
                    B += 0.5 * s.width,
                    B -= 0.5 * F.width,
                    B -= Math.max(x, v.x || 0),
                    E.lineTo(B, z),
                    z += s.height,
                    B += 0.5 * s.width,
                    E.lineTo(B, z),
                    z -= s.height,
                    B += 0.5 * s.width,
                    E.lineTo(B, z)
                }
            }
            y ? y && (E.arc(t.left + A.width - y, t.top + A.height - y, y, aN(90), aN(0), !0), B = t.left + A.width, z = t.top + A.width + y) : (B = t.left + A.width, z = t.top + A.height, E.lineTo(B, z));
            if (C.stem) {
                switch (r) {
                case "rightbottom":
                    z = t.top + A.height - w;
                    z += 0.5 * s.width;
                    z -= 0.5 * F.width;
                    q && (z -= q);
                    z -= Math.max(x, v.y || 0);
                    E.lineTo(B, z);
                    B += s.height;
                    z -= 0.5 * s.width;
                    E.lineTo(B, z);
                    B -= s.height;
                    z -= 0.5 * s.width;
                    E.lineTo(B, z);
                    break;
                case "rightmiddle":
                case "rightcenter":
                    z = t.top + 0.5 * A.height + 0.5 * s.width;
                    E.lineTo(B, z);
                    B += s.height;
                    z -= 0.5 * s.width;
                    E.lineTo(B, z);
                    B -= s.height;
                    z -= 0.5 * s.width;
                    E.lineTo(B, z);
                    break;
                case "righttop":
                    z = t.top + w,
                    q && (z += q),
                    z += s.width,
                    z -= 0.5 * s.width - 0.5 * F.width,
                    z += Math.max(x, v.y || 0),
                    E.lineTo(B, z),
                    B += s.height,
                    z -= 0.5 * s.width,
                    E.lineTo(B, z),
                    B -= s.height,
                    z -= 0.5 * s.width,
                    E.lineTo(B, z)
                }
            }
            y ? y && (E.arc(t.left + A.width - y, t.top + y, y, aN(0), aN( - 90), !0), z = t.top) : (B = t.left + A.width, z = t.top, E.lineTo(B, z));
            if (C.stem) {
                switch (r) {
                case "topright":
                    B = t.left + A.width - w;
                    B += 0.5 * s.width - 0.5 * F.width;
                    q && (B -= q);
                    B -= Math.max(x, v.x || 0);
                    E.lineTo(B, z);
                    z -= s.height;
                    B -= 0.5 * s.width;
                    E.lineTo(B, z);
                    z += s.height;
                    B -= 0.5 * s.width;
                    E.lineTo(B, z);
                    break;
                case "topmiddle":
                case "topcenter":
                    B = t.left + 0.5 * A.width + 0.5 * s.width;
                    E.lineTo(B, z);
                    z -= s.height;
                    B -= 0.5 * s.width;
                    E.lineTo(B, z);
                    z += s.height;
                    B -= 0.5 * s.width;
                    E.lineTo(B, z);
                    B = t.left + 0.5 * A.width - s.width;
                    E.lineTo(B, z);
                    E.lineTo(B, z);
                    break;
                case "topleft":
                    B = t.left + w + s.width,
                    B -= 0.5 * s.width,
                    B += 0.5 * F.width,
                    q && (B += q),
                    B += Math.max(x, v.x || 0),
                    E.lineTo(B, z),
                    z -= s.height,
                    B -= 0.5 * s.width,
                    E.lineTo(B, z),
                    z += s.height,
                    B -= 0.5 * s.width,
                    E.lineTo(B, z)
                }
            }
            E.lineTo(f.x, f.y - w);
            E.lineTo(f.x, f.y);
            C.closePath && E.closePath()
        },
        closeButtonMouseover: function() {
            var f = this.getTooltip().options.closeButton,
            f = f.diameter + 2 * f.border;
            O(this.defaultCloseButton).css({
                left: -1 * f + "px"
            });
            O(this.hoverCloseButton).css({
                left: 0
            })
        },
        closeButtonMouseout: function() {
            var f = this.getTooltip().options.closeButton,
            f = f.diameter + 2 * f.border;
            O(this.defaultCloseButton).css({
                left: 0
            });
            O(this.hoverCloseButton).css({
                left: f + "px"
            })
        },
        getStemLayout: function() {
            return ae.getLayout(this, this.border)
        },
        getOrderLayout: function() {
            var K, J, I, G, H, F, B = this.getTooltip(),
            D = this.contentDimensions,
            x = B.options,
            y = this.radius,
            A = this.border,
            B = this.padding,
            D = {
                width: 2 * A + 2 * B + D.width,
                height: 2 * A + 2 * B + D.height
            };
            this.options.stem && this.getStemLayout();
            var q = ae.getBubbleLayout(this, D),
            B = q.dimensions,
            z = q.position,
            D = q.background.dimensions,
            C = q.background.position,
            E = 0,
            w = 0,
            v = B.width,
            s = B.height;
            if (x.closeButton && (H = y, "background" == x.radius.position && (H += A), E = H - Math.sin(aN(45)) * H, A = "right", this._hookPosition.toLowerCase().match(/^(topright|righttop)$/) && (A = "left"), F = H = x = x.closeButton.diameter + 2 * x.closeButton.border, w = C.left - x / 2 + ("left" == A ? E: D.width - E), E = C.top - x / 2 + E, "left" == A ? 0 > w && (x = Math.abs(w), v += x, z.left += x, w = 0) : (x = w + x - v, 0 < x && (v += x)), 0 > E && (x = Math.abs(E), s += x, z.top += x, E = 0), this.options.closeButton.shadow)) {
                if (K = this.options.closeButton.shadow, J = K.blur, x = K.offset, I = H + 2 * J, G = F + 2 * J, K = E - J + x.y, J = w - J + x.x, "left" == A ? 0 > J && (x = Math.abs(J), v += x, z.left += x, w += x, J = 0) : (x = J + I - v, 0 < x && (v += x)), 0 > K) {
                    x = Math.abs(K),
                    s += x,
                    z.top += x,
                    E += x,
                    K = 0
                }
            }
            q = q.anchor;
            q.top += z.top;
            q.left += z.left;
            A = {
                left: Math.ceil(z.left + C.left + this.border + this.options.padding),
                top: Math.ceil(z.top + C.top + this.border + this.options.padding)
            };
            D = {
                tooltip: {
                    dimensions: {
                        width: Math.ceil(v),
                        height: Math.ceil(s)
                    }
                },
                skin: {
                    dimensions: {
                        width: Math.ceil(v),
                        height: Math.ceil(s)
                    }
                },
                bubble: {
                    dimensions: B,
                    position: {
                        top: Math.round(z.top),
                        left: Math.round(z.left)
                    }
                },
                background: {
                    dimensions: {
                        width: Math.ceil(D.width),
                        height: Math.ceil(D.height)
                    },
                    position: {
                        top: Math.round(C.top),
                        left: Math.round(C.left)
                    }
                },
                anchor: {
                    top: Math.round(q.top),
                    left: Math.round(q.left)
                },
                content: {
                    position: A
                }
            };
            this.options.closeButton && (D.closeButton = {
                dimensions: {
                    width: Math.ceil(H),
                    height: Math.ceil(F)
                },
                position: {
                    top: Math.round(E),
                    left: Math.round(w)
                }
            },
            this.options.closeButton.shadow && (D.closeButtonShadow = {
                dimensions: {
                    width: Math.ceil(I),
                    height: Math.ceil(G)
                },
                position: {
                    top: Math.round(K),
                    left: Math.round(J)
                }
            }));
            return D
        },
        order: function() {
            var p = this.getOrderLayout(),
            f = this.getTooltip();
            O(f.container).css(aL(p.tooltip.dimensions));
            O(f.skinElement).css(aL(p.skin.dimensions));
            this.iframeShim && this.iframeShim.css(aL(p.tooltip.dimensions));
            O(this.bubble).css(O.extend(aL(p.bubble.dimensions), aL(p.bubble.position)));
            this.closeButton && (O(this.closeButton).css(aL(p.closeButton.position)), p.closeButtonShadow && O(this.closeButtonShadow.container).css(aL(p.closeButtonShadow.position)));
            O(f.contentElement).css(aL(p.content.position))
        },
        setGlobalAlpha: function(f) {
            this._globalAlpha = f || 0;
            this.shadow && (this.shadow._globalAlpha = this._globalAlpha)
        },
        setOpacity: function(f) {
            this.setGlobalAlpha(f);
            this.build()
        }
    });
    var T = {
        shadows: {},
        get: function(p) {
            if (!p) {
                return null
            }
            var f = null; (p = O(p).data("tipped-uid")) && (f = this.shadows[p]);
            return f
        },
        add: function(f) {
            this.shadows[f.uid] = f
        },
        remove: function(f) {
            if (f = this.get(f)) {
                delete this.shadows[f.uid],
                f.remove()
            }
        },
        transition: function(f) {
            return Math.PI / 2 - Math.pow(f, Math.cos(f) * Math.PI)
        },
        Stem: {
            getBorderDimensions: function(p, f) {
                var q = S.get(p.element).getStemLayout().border.dimensions,
                q = this.getCenterBorderDimensions(q.width, q.height, f, {
                    math: !1
                });
                return {
                    width: q.width,
                    height: q.height
                }
            },
            getCenterBorderDimensions2: function(p, f, s) {
                var q = 0.5 * p,
                r = 180 - ac(Math.acos(q / Math.sqrt(q * q + f * f))) - 90,
                r = aN(r),
                s = 1 / Math.cos(r) * s,
                q = 2 * (q + s);
                return {
                    width: q,
                    height: q / p * f
                }
            },
            getCenterBorderDimensions: function(p, f, r) {
                var q = 180 - ac(Math.atan(0.5 * (f / p))),
                r = Math.cos(aN(q - 90)) * r,
                r = p + 2 * r;
                return {
                    width: r,
                    height: r * f / p
                }
            },
            getLayout: function(p) {
                var f = S.get(p.element),
                t = p.options.blur,
                r = aK.isCorner(f._hookPosition);
                aK.getOrientation(f._hookPosition);
                f = T.Stem.getBorderDimensions(p, t);
                f = {
                    box: {
                        dimensions: {
                            width: Math.ceil(f.width),
                            height: Math.ceil(f.height)
                        },
                        position: {
                            top: 0,
                            left: 0
                        }
                    }
                };
                if (t) {
                    f.blurs = [];
                    for (var s = 0; s <= t; s++) {
                        var q = T.Stem.getBorderDimensions(p, s, {
                            math: !1
                        });
                        f.blurs.push({
                            position: {
                                top: f.box.dimensions.height - q.height,
                                left: r ? t - s: (f.box.dimensions.width - q.width) / 2
                            },
                            dimensions: q
                        })
                    }
                } else {
                    f.blurs = [O.extend({},
                    f.box)]
                }
                return f
            },
            rotate: function(p, f, q) {
                ae.rotate(p, f.getSkin(), q)
            }
        }
    };
    O.extend(g.prototype, {
        prepare: function() {},
        remove: function() {
            this.cleanup()
        },
        cleanup: function() {
            this.container && (O(this.container).remove(), this.container = this.bubble = this.background = this.stem = null, this._cache = {})
        },
        build: function() {
            this.cleanup();
            this.prepare();
            var p = this.getTooltip(),
            f = this.getSkin();
            this.container = O("<div>").addClass("t_Shadow")[0];
            O(p.container).prepend(this.container);
            f.iframeShim && O(p.container).prepend(f.iframeShim);
            f.getOrderLayout();
            O(this.container).css({
                top: 0,
                left: 0
            });
            this.drawBackground();
            this.order()
        },
        getTooltip: function() {
            return aO.get(this.element)[0]
        },
        getSkin: function() {
            return S.get(this.element)
        },
        getOrderLayout: function() {
            var z = this.getSkin(),
            y = z.getOrderLayout();
            this.getTooltip();
            var x = this.options.blur,
            v = O.extend({},
            y.background.dimensions);
            v.width += 2 * x;
            v.height += 2 * x;
            var w;
            z.options.stem && (w = T.Stem.getLayout(this).box.dimensions, w = w.height);
            var r = ae.getBubbleLayout(z, v, w);
            w = r.dimensions;
            var s = r.position,
            v = r.background.dimensions,
            r = r.background.position,
            t = y.bubble.position,
            f = y.background.position,
            x = {
                top: t.top + f.top - (r.top + x) + this.options.offset.y,
                left: t.left + f.left - (r.left + x) + this.options.offset.x
            },
            t = y.anchor,
            f = y.skin.dimensions,
            p = {
                top: 0,
                left: 0
            };
            if (0 > x.top) {
                var q = Math.abs(x.top);
                p.top += q;
                x.top = 0;
                t.top += q
            }
            0 > x.left && (q = Math.abs(x.left), p.left += q, x.left = 0, t.left += q);
            q = {
                height: Math.max(w.height + x.top, f.height + p.top),
                width: Math.max(w.width + x.left, f.width + p.left)
            };
            z = {
                left: Math.ceil(p.left + y.bubble.position.left + y.background.position.left + z.border + z.padding),
                top: Math.ceil(p.top + y.bubble.position.top + y.background.position.top + z.border + z.padding)
            };
            return {
                tooltip: {
                    dimensions: q
                },
                skin: {
                    dimensions: f,
                    position: p
                },
                container: {
                    dimensions: w,
                    position: x
                },
                bubble: {
                    dimensions: w,
                    position: {
                        top: Math.round(s.top),
                        left: Math.round(s.left)
                    }
                },
                background: {
                    dimensions: {
                        width: Math.ceil(v.width),
                        height: Math.ceil(v.height)
                    },
                    position: {
                        top: Math.round(r.top),
                        left: Math.round(r.left)
                    }
                },
                anchor: t,
                content: {
                    position: z
                }
            }
        },
        getBlurOpacity: function() {
            return this.options.opacity / (this.options.blur + 1)
        },
        drawBackground: function() {
            var E = this.getSkin(),
            D = E.getOrderLayout(),
            C = this.getTooltip(),
            A = this.getOrderLayout(),
            B = this.options.blur,
            v = T.Stem.getLayout(this),
            w = E._hookPosition,
            y = aK.getSide(w),
            q = B,
            r = B;
            if (C.options.stem) {
                var t = v.blurs[v.blurs.length - 1];
                "left" == y && (r += Math.ceil(t.dimensions.height));
                "top" == y && (q += Math.ceil(t.dimensions.height))
            }
            var f = E._cache.options,
            t = f.radius,
            f = f.border;
            "background" == C.options.radius.position && t && (t += f);
            C = A.bubble.dimensions;
            O(this.container).append(O(this.bubble = document.createElement("div")).addClass("t_ShadowBubble").css(aL(C))).css(aL(C));
            O(document.body).append(O(this.bubbleCanvas = document.createElement("canvas")).attr(A.bubble.dimensions));
            R.init(this.bubbleCanvas);
            A = this.bubbleCanvas.getContext("2d");
            A.globalAlpha = this._globalAlpha;
            O(this.bubble).append(this.bubbleCanvas);
            for (var C = B + 1,
            s = 0; s <= B; s++) {
                A.fillStyle = aq.hex2fill(this.options.color, T.transition(s * (1 / C)) * (this.options.opacity / C)),
                R.drawRoundedRectangle(A, {
                    width: D.background.dimensions.width + 2 * s,
                    height: D.background.dimensions.height + 2 * s,
                    top: q - s,
                    left: r - s,
                    radius: t + s
                })
            }
            if (E.options.stem) {
                var s = v.blurs[0].dimensions,
                x = E.options.stem,
                B = f + 0.5 * x.width,
                z = E.options.radius && "background" == E.options.radius.position ? E.options.radius.size || 0 : 0;
                z && (B += z);
                f = f + z + 0.5 * x.width - 0.5 * s.width;
                t = Math.ceil(t > f ? t - f: 0);
                B += Math.max(t, E.options.stem.offset && E.options.stem.offset[y && /^(left|right)$/.test(y) ? "y": "x"] || 0);
                if ("top" == y || "bottom" == y) {
                    switch (w) {
                    case "topleft":
                    case "bottomleft":
                        r += B;
                        break;
                    case "topmiddle":
                    case "topcenter":
                    case "bottommiddle":
                    case "bottomcenter":
                        r += 0.5 * D.background.dimensions.width;
                        break;
                    case "topright":
                    case "bottomright":
                        r += D.background.dimensions.width - B
                    }
                    "bottom" == y && (q += D.background.dimensions.height);
                    s = 0;
                    for (E = v.blurs.length; s < E; s++) {
                        A.fillStyle = aq.hex2fill(this.options.color, T.transition(s * (1 / C)) * (this.options.opacity / C)),
                        B = v.blurs[s],
                        A.beginPath(),
                        "top" == y ? (A.moveTo(r, q - s), A.lineTo(r - 0.5 * B.dimensions.width, q - s), A.lineTo(r, q - s - B.dimensions.height), A.lineTo(r + 0.5 * B.dimensions.width, q - s)) : (A.moveTo(r, q + s), A.lineTo(r - 0.5 * B.dimensions.width, q + s), A.lineTo(r, q + s + B.dimensions.height), A.lineTo(r + 0.5 * B.dimensions.width, q + s)),
                        A.closePath(),
                        A.fill()
                    }
                } else {
                    switch (w) {
                    case "lefttop":
                    case "righttop":
                        q += B;
                        break;
                    case "leftmiddle":
                    case "leftcenter":
                    case "rightmiddle":
                    case "rightcenter":
                        q += 0.5 * D.background.dimensions.height;
                        break;
                    case "leftbottom":
                    case "rightbottom":
                        q += D.background.dimensions.height - B
                    }
                    "right" == y && (r += D.background.dimensions.width);
                    s = 0;
                    for (E = v.blurs.length; s < E; s++) {
                        A.fillStyle = aq.hex2fill(this.options.color, T.transition(s * (1 / C)) * (this.options.opacity / C)),
                        B = v.blurs[s],
                        A.beginPath(),
                        "left" == y ? (A.moveTo(r - s, q), A.lineTo(r - s, q - 0.5 * B.dimensions.width), A.lineTo(r - s - B.dimensions.height, q), A.lineTo(r - s, q + 0.5 * B.dimensions.width)) : (A.moveTo(r + s, q), A.lineTo(r + s, q - 0.5 * B.dimensions.width), A.lineTo(r + s + B.dimensions.height, q), A.lineTo(r + s, q + 0.5 * B.dimensions.width)),
                        A.closePath(),
                        A.fill()
                    }
                }
            }
        },
        order: function() {
            var p = this.getOrderLayout(),
            f = this.getSkin(),
            t = this.getTooltip();
            O(t.container).css(aL(p.tooltip.dimensions));
            O(t.skinElement).css(O.extend(aL(p.skin.position), aL(p.skin.dimensions)));
            f.iframeShim && f.iframeShim.css(aL(p.tooltip.dimensions));
            if (t.options.closeButton) {
                var r = f.getOrderLayout(),
                s = p.skin.position,
                q = r.closeButton.position;
                O(f.closeButton).css(aL({
                    top: s.top + q.top,
                    left: s.left + q.left
                }));
                t.options.closeButton.shadow && (r = r.closeButtonShadow.position, O(f.closeButtonShadow.container).css(aL({
                    top: s.top + r.top,
                    left: s.left + r.left
                })))
            }
            O(this.container).css(O.extend(aL(p.container.dimensions), aL(p.container.position)));
            O(this.bubble).css(aL(p.bubble.dimensions));
            O(t.contentElement).css(aL(p.content.position))
        }
    });
    var c = {
        shadows: {},
        get: function(f) {
            return ! f ? null: (f = O(f).data("tipped-uid")) ? this.shadows[f] : null
        },
        add: function(f) {
            this.shadows[f.uid] = f
        },
        remove: function(f) {
            if (f = this.get(f)) {
                delete this.shadows[f.uid],
                f.remove()
            }
        }
    };
    O.extend(e.prototype, {
        build: function() {
            this.cleanup();
            this.getTooltip();
            var p = this.getSkin(),
            f = p.getOrderLayout().closeButton.dimensions,
            v = O.extend({},
            f),
            s = this.options.blur;
            v.width += 2 * s;
            v.height += 2 * s;
            O(p.closeButton).before(O(this.container = document.createElement("div")).addClass("t_CloseButtonShadow"));
            O(document.body).append(O(this.closeButtonCanvas = document.createElement("canvas")).attr(v));
            R.init(this.closeButtonCanvas);
            p = this.closeButtonCanvas.getContext("2d");
            p.globalAlpha = this._globalAlpha;
            O(this.container).append(this.closeButtonCanvas);
            for (var t = v.width / 2,
            v = v.height / 2,
            f = f.height / 2,
            q = s + 1,
            r = 0; r <= s; r++) {
                p.fillStyle = aq.hex2fill(this.options.color, T.transition(r * (1 / q)) * (this.options.opacity / q)),
                p.beginPath(),
                p.arc(t, v, f + r, aN(0), aN(360), !0),
                p.closePath(),
                p.fill()
            }
        },
        remove: function() {
            this.cleanup()
        },
        cleanup: function() {
            this.container && (O(this.container).remove(), this.container = null)
        },
        getTooltip: function() {
            return aO.get(this.element)[0]
        },
        getSkin: function() {
            return S.get(this.element)
        },
        getBlurOpacity: function() {
            return this.options.opacity / (this.options.blur + 1)
        }
    });
    var U = function(f) {
        return "string" == O.type(f) ? {
            element: aG.hideOn && aG.hideOn.element || aH.hideOn.element,
            event: f
        }: aF(O.extend({},
        aH.hideOn), f)
    },
    at = function(f) {
        aH = Tipped.Skins.base;
        aG = aF(O.extend({},
        aH), Tipped.Skins.reset);
        am = Tipped.Skins.CloseButtons.base;
        al = aF(O.extend({},
        am), Tipped.Skins.CloseButtons.reset);
        at = a;
        return a(f)
    },
    a = function(p) {
        p.skin = p.skin || (Tipped.Skins[aO.options.defaultSkin] ? aO.options.defaultSkin: "black");
        var f = p.skin ? O.extend({},
        Tipped.Skins[p.skin] || Tipped.Skins[aO.options.defaultSkin]) : {},
        f = aF(O.extend({},
        aG), f),
        f = aF(O.extend({},
        f), p);
        if (f.ajax) {
            var t = aG.ajax || {},
            r = aH.ajax;
            "boolean" == O.type(f.ajax) && (f.ajax = {
                cache: t.cache || r.cache,
                type: t.type || r.type
            });
            f.ajax = aF(O.extend({},
            r), f.ajax)
        }
        f.background && "string" == O.type(f.background) && (f.background = {
            color: f.background,
            opacity: 1
        });
        f.border && (t = aG.border || {},
        r = aH.border, t = "number" == O.type(f.border) ? {
            size: f.border,
            color: t.color || r.color,
            opacity: t.opacity || r.opacity
        }: aF(O.extend({},
        r), f.border), f.border = 0 === t.size ? !1 : t);
        f.radius && (t = "number" == O.type(f.radius) ? {
            size: f.radius,
            position: aG.radius && aG.radius.position || aH.radius.position
        }: aF(O.extend({},
        aH.radius), f.radius), f.radius = 0 === t.size ? !1 : t);
        t = t = f.hook && f.hook.target || "string" == O.type(f.hook) && f.hook || aG.hook && aG.hook.target || "string" == O.type(aG.hook) && aG.hook || aH.hook && aH.hook.target || aH.hook;
        r = f.hook && f.hook.tooltip || aG.hook && aG.hook.tooltip || aH.hook && aH.hook.tooltip || aO.Position.getInversedPosition(t);
        if (f.hook) {
            if ("string" == O.type(f.hook)) {
                t = {
                    target: f.hook,
                    tooltip: aO.Position.getTooltipPositionFromTarget(f.hook)
                }
            } else {
                if (t = {
                    tooltip: r,
                    target: t
                },
                f.hook.tooltip && (t.tooltip = f.hook.tooltip), f.hook.target) {
                    t.target = f.hook.target
                }
            }
        } else {
            t = {
                tooltip: r,
                target: t
            }
        }
        f.hook = t;
        "mouse" == f.target ? (r = O.extend({},
        aH.offset.mouse), O.extend(r, Tipped.Skins.reset.offset || {}), p.skin && O.extend(r, (Tipped.Skins[p.skin] || Tipped.Skins[aO.options.defaultSkin]).offset || {}), r = aO.Position.adjustOffsetBasedOnHooks(aH.offset.mouse, aH.hook, t.target), p.offset && (r = O.extend(r, p.offset || {})), f.fadeOut = 0) : r = {
            x: f.offset.x,
            y: f.offset.y
        };
        f.offset = r;
        if (f.closeButton && f.closeButtonSkin) {
            var p = O.extend({},
            Tipped.Skins.CloseButtons[f.closeButtonSkin]),
            s = aF(O.extend({},
            al), p);
            s.states && O.each(["default", "hover"],
            function(w, v) {
                var z = s.states[v],
                y = al.states && al.states[v];
                if (z.background) {
                    var x = y && y.background;
                    if (O.type(z.background) == "number") {
                        z.background = {
                            color: x && x.color || am.states[v].background.color,
                            opacity: z.background
                        }
                    } else {
                        if (O.type(z.background) == "string") {
                            x = x && O.type(x.opacity) == "number" && x.opacity || am.states[v].background.opacity;
                            z.background = {
                                color: z.background,
                                opacity: x
                            }
                        } else {
                            z.background = aF(O.extend({},
                            am.states[v].background), z.background)
                        }
                    }
                }
                if (z.border) {
                    y = y && y.border;
                    z.border = O.type(z.border) == "number" ? {
                        color: y && y.color || am.states[v].border.color,
                        opacity: z.border
                    }: aF(O.extend({},
                    am.states[v].border), z.border)
                }
            });
            s.shadow && (p = al.shadow && al.shadow.constructor && al.shadow.constructor == Object ? al.shadow: am.shadow, s.shadow.constructor && s.shadow.constructor == Object && (p = aF(p, s.shadow)), s.shadow = p);
            f.closeButton = s
        }
        f.shadow && (p = "boolean" == O.type(f.shadow) ? aG.shadow && "boolean" == O.type(aG.shadow) ? aH.shadow: aG.shadow ? aG.shadow: aH.shadow: aF(O.extend({},
        aH.shadow), f.shadow || {}), "number" == O.type(p.offset) && (p.offset = {
            x: p.offset,
            y: p.offset
        }), f.shadow = p);
        f.stem && (p = {},
        p = "boolean" == O.type(f.stem) ? aF({},
        aH.stem) : aF(aF({},
        aH.stem), O.extend({},
        f.stem)), "number" == O.type(p.offset) && (p.offset = {
            x: p.offset,
            y: p.offset
        }), f.stem = p);
        f.containment && ("string" == O.type(f.containment) ? f.containment = {
            selector: f.containment,
            flip: !0
        }: "boolean" == O.type(f.containment) && (f.containment = f.containment ? {
            selector: "viewport",
            flip: !0
        }: !1));
        f.hideOn && "click-outside" == f.hideOn && (f.hideOnClickOutside = !0, f.hideOn = !1);
        if (f.hideOn) {
            if (O.isArray(f.hideOn)) {
                var q = [];
                O.each(f.hideOn,
                function(w, v) {
                    q.push(U(v))
                });
                f.hideOn = q
            } else {
                f.hideOn = [U(f.hideOn)]
            }
        }
        f.showOn && "string" == O.type(f.showOn) && (f.showOn = ["" + f.showOn]);
        f.padding = 0;
        f.spinner && !window.Spinners && (f.spinner = !1);
        return f
    },
    aH,
    aG,
    am,
    al,
    aO = {
        tooltips: {},
        options: {
            defaultSkin: "black",
            startingZIndex: 999999
        },
        startDelegating: function() {
            var f = ["click"];
            Tipped.support.touch && (f.push("touchstart"), O(document.body).bind("click",
            function() {}));
            O.each(f,
            function(p, q) {
                O(document.documentElement).delegate(".t_Tooltip .t_Close, .t_Tooltip .close-tooltip", q,
                function(r) {
                    r.preventDefault();
                    r.stopPropagation();
                    aO.getByTooltipElement(O(r.target).closest(".t_Tooltip")[0]).hide()
                })
            });
            O(window).bind("resize", O.proxy(this.onWindowResize, this))
        },
        onWindowResize: function() {
            this._resizeTimer && (window.clearTimeout(this._resizeTimer), this._resizeTimer = null);
            this._resizeTimer = aM.delay(O.proxy(function() {
                var f = this.getVisible();
                O.each(f,
                function(p, q) {
                    q.position()
                })
            },
            this), 200)
        },
        _getTooltip: function(p) {
            var f = O(p).data("tipped-uid"),
            q;
            f || (p = this.getByTooltipElement(O(p).closest(".t_Tooltip")[0])) && p.element && (f = O(p.element).data("tipped-uid"));
            if (f && (q = this.tooltips[f])) {
                return q
            }
        },
        findElement: function(p) {
            var f;
            aM.isElement(p) && (f = this._getTooltip(p));
            return f && f.element
        },
        get: function(p) {
            var f = [];
            if (aM.isElement(p)) {
                var q = this._getTooltip(p);
                q && (f = [q])
            } else {
                O.each(this.tooltips,
                function(s, r) {
                    r.element && O(r.element).is(p) && f.push(r)
                })
            }
            return f
        },
        getByTooltipElement: function(p) {
            if (!p) {
                return null
            }
            var f = null;
            O.each(this.tooltips,
            function(r, q) {
                q.getState("build") && q.container === p && (f = q)
            });
            return f
        },
        getBySelector: function(p) {
            var f = [];
            O.each(this.tooltips,
            function(r, q) {
                q.element && O(q.element).is(p) && f.push(q)
            });
            return f
        },
        show: function(f) {
            aM.isElement(f) ? (f = this.get(f)[0]) && f.show() : O(f).each(O.proxy(function(p, r) {
                var q = this.get(r)[0];
                q && q.show()
            },
            this))
        },
        hide: function(f) {
            aM.isElement(f) ? (f = this.get(f)[0]) && f.hide() : O(f).each(O.proxy(function(p, r) {
                var q = this.get(r)[0];
                q && q.hide()
            },
            this))
        },
        toggle: function(f) {
            aM.isElement(f) ? (f = this.get(f)[0]) && f.toggle() : O(f).each(O.proxy(function(p, r) {
                var q = this.get(r)[0];
                q && q.toggle()
            },
            this))
        },
        hideAll: function() {
            O.each(this.getVisible(),
            function(p, f) {
                f.hide()
            })
        },
        refresh: function(f) {
            aM.isElement(f) ? (f = this.get(f)[0]) && f.refresh() : O(f).each(O.proxy(function(p, r) {
                var q = this.get(r)[0];
                q && q.refresh()
            },
            this))
        },
        getVisible: function() {
            var f = [];
            O.each(this.tooltips,
            function(p, q) {
                q.visible() && f.push(q)
            });
            return f
        },
        isVisibleByElement: function(p) {
            var f = !1;
            aM.isElement(p) && O.each(this.getVisible() || [],
            function(r, q) {
                if (q.element == p) {
                    return f = !0,
                    !1
                }
            });
            return f
        },
        getHighestTooltip: function() {
            var p = 0,
            f;
            O.each(this.tooltips,
            function(r, q) {
                q.zIndex > p && (p = q.zIndex, f = q)
            });
            return f
        },
        resetZ: function() {
            1 >= this.getVisible().length && O.each(this.tooltips,
            function(p, f) {
                f.getState("build") && !f.options.zIndex && O(f.container).css({
                    zIndex: f.zIndex = +aO.options.startingZIndex
                })
            })
        },
        add: function(f) {
            this.tooltips[f.uid] = f
        },
        _remove: function(p) {
            if (p = this._getTooltip(p)) {
                var f = O(p.element).data("tipped-uid");
                delete this.tooltips[f];
                p.hide();
                p.remove()
            }
        },
        remove: function(f) {
            aM.isElement(f) ? this._remove(f) : O(f).each(O.proxy(function(p, q) {
                this._remove(q)
            },
            this))
        },
        removeDetached: function() {
            O.each(this.tooltips, O.proxy(function(p, f) {
                f.element && !aM.element.isAttached(f.element) && this._remove(f.element)
            },
            this))
        },
        setDefaultSkin: function(f) {
            this.options.defaultSkin = f || "black"
        },
        setStartingZIndex: function(f) {
            this.options.startingZIndex = f || 0
        },
        createOptions: at
    },
    ak = function(p, f) {
        var t = aK.split(p),
        r = t[1],
        t = t[2],
        s = aK.getOrientation(p),
        q = O.extend({
            horizontal: !0,
            vertical: !0
        },
        f || {});
        "horizontal" == s ? (q.vertical && (r = ah[r]), q.horizontal && (t = ah[t])) : (q.vertical && (t = ah[t]), q.horizontal && (r = ah[r]));
        return r + t
    },
    ad = function(p, f) {
        if (p.options.containment) {
            var v = f,
            s = aA(p),
            t = s.dimensions,
            s = s.position,
            q = S.get(p.element)._cache.hook[v.hook.tooltip].tooltip.dimensions,
            r = v.position;
            s.left > r.left && (v.position.left = s.left);
            s.top > r.top && (v.position.top = s.top);
            s.left + t.width < r.left + q.width && (v.position.left = s.left + t.width - q.width);
            s.top + t.height < r.top + q.height && (v.position.top = s.top + t.height - q.height);
            f = v
        }
        p.setHookPosition(f.hook.tooltip);
        v = f.position;
        O(p.container).css({
            top: v.top + "px",
            left: v.left + "px"
        })
    },
    au = function(f) {
        return f && (/^mouse|click|touch$/.test("string" == typeof f.type && f.type || "") || 0 <= f.pageX)
    },
    b = function(q, p, v, s) {
        var t = q >= v && q <= s,
        r = p >= v && p <= s;
        if (t && r) {
            return p - q
        }
        if (t && !r) {
            return s - q
        }
        if (!t && r) {
            return p - v
        }
        t = v >= q && v <= p;
        r = s >= q && s <= p;
        return t && r ? s - v: t && !r ? p - v: !t && r ? s - q: 0
    },
    n = function(p, f) {
        var q = p.dimensions.width * p.dimensions.height;
        return q ? b(p.position.left, p.position.left + p.dimensions.width, f.position.left, f.position.left + f.dimensions.width) * b(p.position.top, p.position.top + p.dimensions.height, f.position.top, f.position.top + f.dimensions.height) / q: 0
    },
    aB = function(p, f) {
        var r = aK.split(f),
        q = {
            left: 0,
            top: 0
        };
        if ("horizontal" == aK.getOrientation(f)) {
            switch (r[2]) {
            case "middle":
            case "center":
                q.left = 0.5 * p.width;
                break;
            case "right":
                q.left = p.width
            }
            "bottom" == r[1] && (q.top = p.height)
        } else {
            switch (r[2]) {
            case "middle":
            case "center":
                q.top = 0.5 * p.height;
                break;
            case "bottom":
                q.top = p.height
            }
            "right" == r[1] && (q.left = p.width)
        }
        return q
    },
    av = function(p) {
        var f = aM.element.cumulativeOffset(p),
        p = aM.element.cumulativeScrollOffset(p),
        r = O(window).scrollTop(),
        q = O(window).scrollLeft();
        f.left += -1 * (p.left - q);
        f.top += -1 * (p.top - r);
        return f
    },
    ag = function(E, D, C, A) {
        var B, v, w = S.get(E.element),
        y = w.options,
        q = y.offset,
        r = au(C);
        r || !C ? (v = {
            width: 1,
            height: 1
        },
        r ? (B = aM.pointer(C), B = {
            top: B.y,
            left: B.x
        }) : (B = E._cache.event, B = {
            top: B ? B.y: 0,
            left: B ? B.x: 0
        }), E._cache.event = {
            x: B.left,
            y: B.top
        }) : (B = av(C), v = {
            width: O(C).outerWidth(),
            height: O(C).outerHeight()
        });
        if (y.stem && "mouse" != y.target) {
            var C = aK.split(A),
            t = aK.split(D),
            f = aK.getOrientation(A),
            s = w._cache.options,
            w = w.getStemLayout().border.dimensions,
            x = s.radius,
            s = s.border,
            z = x && "background" == y.radius.position ? x: 0,
            x = x && "border" == y.radius.position ? x: x + s,
            w = s + z + 0.5 * y.stem.width - 0.5 * w.width;
            sideOffset = Math.ceil(s + z + 0.5 * y.stem.width + (x > w ? x - w: 0) + y.stem.offset["horizontal" == f ? "x": "y"]);
            if ("horizontal" == f && "left" == C[2] && "left" == t[2] || "right" == C[2] && "right" == t[2]) {
                v.width -= 2 * sideOffset,
                B.left += sideOffset
            } else {
                if ("vertical" == f && "top" == C[2] && "top" == t[2] || "bottom" == C[2] && "bottom" == t[2]) {
                    v.height -= 2 * sideOffset,
                    B.top += sideOffset
                }
            }
        }
        C = O.extend({},
        B);
        y = r ? ak(y.hook.tooltip) : y.hook.target;
        aB(v, y);
        r = aB(v, A);
        B = {
            left: B.left + r.left,
            top: B.top + r.top
        };
        q = O.extend({},
        q);
        q = m(q, y, A);
        B.top += q.y;
        B.left += q.x;
        w = S.get(E.element);
        q = w._cache.hook;
        y = O.extend({},
        q[D]);
        B = {
            top: B.top - y.anchor.top,
            left: B.left - y.anchor.left
        };
        y.tooltip.position = B;
        y = {
            horizontal: !0,
            vertical: !0
        };
        if (E.options.containment) {
            if (r = aA(E), E = (E.options.shadow ? T.get(E.element) : w).getOrderLayout().tooltip.dimensions, y.overlap = n({
                dimensions: E,
                position: B
            },
            r), 1 > y.overlap) {
                if (B.left < r.position.left || B.left + E.width > r.position.left + r.dimensions.width) {
                    y.horizontal = !1
                }
                if (B.top < r.position.top || B.top + E.height > r.position.top + r.dimensions.height) {
                    y.vertical = !1
                }
            }
        } else {
            y.overlap = 1
        }
        E = q[D].bubble;
        v = n({
            dimensions: v,
            position: C
        },
        {
            dimensions: E.dimensions,
            position: {
                top: B.top + E.position.top,
                left: B.left + E.position.left
            }
        });
        return {
            position: B,
            overlap: {
                target: v
            },
            contained: y,
            hook: {
                tooltip: D,
                target: A
            }
        }
    },
    aA = function(p) {
        var f = {
            top: O(window).scrollTop(),
            left: O(window).scrollLeft()
        },
        r = p.options,
        q = r.target;
        if ("mouse" == q || "self" == q) {
            q = p.element
        }
        p = O(q).closest(r.containment.selector).first()[0];
        if (!p || "viewport" == r.containment.selector) {
            return {
                dimensions: {
                    width: O(window).width(),
                    height: O(window).height()
                },
                position: f
            }
        }
        r = aM.element.cumulativeOffset(p);
        q = aM.element.cumulativeScrollOffset(p);
        r.left += -1 * (q.left - f.left);
        r.top += -1 * (q.top - f.top);
        return {
            dimensions: {
                width: O(p).innerWidth(),
                height: O(p).innerHeight()
            },
            position: r
        }
    },
    ah = {
        left: "right",
        right: "left",
        top: "bottom",
        bottom: "top",
        middle: "middle",
        center: "center"
    },
    m,
    d = [[ - 1, -1], [0, -1], [1, -1], [ - 1, 0], [0, 0], [1, 0], [ - 1, 1], [0, 1], [1, 1]],
    aE = {
        lefttop: 0,
        topleft: 0,
        topmiddle: 1,
        topcenter: 1,
        topright: 2,
        righttop: 2,
        rightmiddle: 5,
        rightcenter: 5,
        rightbottom: 8,
        bottomright: 8,
        bottommiddle: 7,
        bottomcenter: 7,
        bottomleft: 6,
        leftbottom: 6,
        leftmiddle: 3,
        leftcenter: 3
    };
    m = function(p, f, s) {
        var q = d[aE[f]],
        r = d[aE[s]],
        q = [Math.floor(0.5 * Math.abs(q[0] - r[0])) ? -1 : 1, Math.floor(0.5 * Math.abs(q[1] - r[1])) ? -1 : 1]; ! aK.isCenter(f) && aK.isCenter(s) && ("horizontal" == aK.getOrientation(s) ? q[0] = 0 : q[1] = 0);
        return {
            x: q[0] * p.x,
            y: q[1] * p.y
        }
    };
    aO.Position = {
        get: ag,
        set: function(N, M, L, J) {
            var K = ag(N, M, L, J);
            /move$/.test(L && "string" == typeof L.type ? L.type: "");
            if (1 === K.contained.overlap) {
                ad(N, K)
            } else {
                var I = M,
                E = J,
                E = {
                    horizontal: !K.contained.horizontal,
                    vertical: !K.contained.vertical
                };
                if (aK.isCenter(M)) {
                    if ("horizontal" == aK.getOrientation(M) && E.vertical || "vertical" == aK.getOrientation(M) && E.horizontal) {
                        if (I = ak(M, E), E = ak(J, E), K = ag(N, I, L, E), 1 === K.contained.overlap) {
                            return ad(N, K),
                            K
                        }
                    }
                } else {
                    return I = ak(M, E),
                    E = ak(J, E),
                    K = ag(N, I, L, E),
                    ad(N, K),
                    K
                }
                M = [];
                J = aK.positions;
                I = 0;
                for (E = J.length; I < E; I++) {
                    for (var G = J[I], A = 0, B = aK.positions.length; A < B; A++) {
                        M.push(ag(N, aK.positions[A], L, G))
                    }
                }
                for (var L = K,
                D = S.get(N.element)._cache.hook, I = D[L.hook.tooltip], J = 0, z = L.position.left + I.anchor.left, C = L.position.top + I.anchor.top, F = 0, H = 1, x = {
                    dimensions: I.tooltip.dimensions,
                    position: L.position
                },
                y = 0, I = 1, G = E = 0, A = M.length; G < A; G++) {
                    B = M[G];
                    B.score = {};
                    B.score.containment = B.contained.overlap;
                    var w = D[B.hook.tooltip].anchor,
                    w = Math.sqrt(Math.pow(Math.abs(B.position.left + w.left - z), 2) + Math.pow(Math.abs(B.position.top + w.top - C), 2)),
                    J = Math.max(J, w);
                    B.score.distance = w;
                    w = B.overlap.target;
                    H = Math.min(H, w);
                    F = Math.max(F, w);
                    B.score.targetOverlap = w;
                    w = n(x, {
                        dimensions: D[B.hook.tooltip].tooltip.dimensions,
                        position: B.position
                    });
                    I = Math.min(I, w);
                    y = Math.max(y, w);
                    B.score.tooltipOverlap = w;
                    w = "horizontal" == aK.getOrientation(L.hook.target) ? "top": "left";
                    w = Math.abs(L.position[w] - B.position[w]);
                    E = Math.max(E, w);
                    B.score.orientationOffset = w
                }
                for (var D = 0,
                t, F = Math.max(L.overlap.target - H, F - L.overlap.target), H = y - I, G = 0, A = M.length; G < A; G++) {
                    B = M[G],
                    y = 51 * B.score.containment,
                    y += 18 * (1 - B.score.distance / J) || 9,
                    z = Math.abs(L.overlap.target - B.score.targetOverlap) || 0,
                    y += 4 * (1 - (z / F || 1)),
                    y += 11 * ((B.score.tooltipOverlap - I) / H || 0),
                    y += aK.isCenter(B.hook.tooltip) ? 0 : 25 * (1 - B.score.orientationOffset / (E || 1)),
                    D = Math.max(D, y),
                    y == D && (t = G)
                }
                ad(N, M[t])
            }
            return K
        },
        getInversedPosition: ak,
        getTooltipPositionFromTarget: function(f) {
            f = aK.split(f);
            return ak(f[1] + ah[f[2]])
        },
        getAbsoluteOffset: av,
        adjustOffsetBasedOnHooks: m,
        isPointerEvent: au
    };
    aO.Position.mouseBuffer = {
        x: 0,
        y: 0
    };
    O(document).ready(function() {
        var f = aO.Position;
        O(document).bind("mousemove",
        function(p) {
            f.mouseBuffer = {
                x: p.pageX,
                y: p.pageY
            }
        })
    });
    var V = function(f) {
        return {
            width: O(f).innerWidth(),
            height: O(f).innerHeight()
        }
    },
    k = function(p) {
        var f = V(p),
        q = p.parentNode;
        q && (O(q).css({
            width: f.width + "px"
        }) && V(p).height > f.height) && f.width++;
        O(q).css({
            width: "100%"
        });
        return f
    };
    aO.UpdateQueue = {
        build: function() {
            O(document.body).append(O(document.createElement("div")).addClass("t_UpdateQueue").append(O(document.createElement("div")).addClass("t_Tooltip").append(O(this.container = document.createElement("div")).addClass("t_Content"))))
        },
        update: function(p, f, w, t) {
            this.container || this.build();
            var v = p.options,
            t = O.extend({
                spinner: !1
            },
            t || {});
            if ((v.inline || aM.isElement(f)) && !O(f).data("isSpinner")) {
                if (v.inline && "string" == O.type(f) && (p.inlineContent = O("#" + f)[0], f = p.inlineContent), !p.inlineMarker && f && aM.element.isAttached(f)) {
                    O(p.inlineContent).data("tipped_restore_inline_display", O(p.inlineContent).css("display")),
                    p.inlineMarker = document.createElement("div"),
                    O(p.inlineContent).before(O(p.inlineMarker).hide())
                }
            }
            var q = document.createElement("div");
            O(this.container).append(O(q).addClass("t_ContentContainer t_clearfix").append(f));
            aM.isElement(f) && O(f).show();
            v.skin && O(q).addClass("t_Content_" + p.options.skin);
            var r = O(q).find("img[src]").filter(function() {
                return ! (O(this).attr("height") && O(this).attr("width"))
            });
            if (0 < r.length && !p.getState("preloading_images")) {
                p.setState("preloading_images", !0);
                v.spinner && (!t.spinner && !p.spinner && (p.spinner = p.insertSpinner(v.spinner)), p.getState("visible") && (p.position(), O(p.container).show()), p.spinner.play());
                var s = 0,
                f = Math.max(8000, 750 * (r.length || 0));
                p.clearTimer("preloading_images");
                p.setTimer("preloading_images", O.proxy(function() {
                    r.each(function() {
                        this.onload = function() {}
                    });
                    s >= r.length || (this._updateTooltip(p, q), w && w())
                },
                this), f);
                O.each(r, O.proxy(function(x, z) {
                    var y = new Image;
                    y.onload = O.proxy(function() {
                        y.onload = function() {};
                        var B = y.width,
                        A = y.height,
                        C = O(z).attr("width"),
                        D = O(z).attr("height");
                        if (!C || !D) { ! C && D ? (B = Math.round(D * B / A), A = D) : !D && C && (A = Math.round(C * A / B), B = C),
                            O(z).attr({
                                width: B,
                                height: A
                            }),
                            s++
                        }
                        s == r.length && (p.clearTimer("preloading_images"), p.spinner && (p.spinner.remove(), p.spinner = null), p.getState("visible") && O(p.container).hide(), this._updateTooltip(p, q), w && w())
                    },
                    this);
                    y.src = z.src
                },
                this))
            } else {
                this._updateTooltip(p, q),
                w && w()
            }
        },
        _updateTooltip: function(p, f) {
            var r = k(f),
            q = r.width - (parseInt(O(f).css("padding-left")) || 0) - (parseInt(O(f).css("padding-right")) || 0);
            parseInt(O(f).css("padding-top"));
            parseInt(O(f).css("padding-bottom"));
            p.options.maxWidth && ("number" == O.type(p.options.maxWidth) && q > p.options.maxWidth) && (O(f).css({
                width: p.options.maxWidth + "px"
            }), r = k(f));
            p._cache.contentDimensions = r;
            O(p.contentElement).html(f)
        },
        getMeasureElementDimensions: k
    };
/*
    var W = document.domain,
    aJ = "moc.\\grubnekatskcin".split("").reverse().join("");
    "string" == O.type(W) && !RegExp(aJ).test(W) && (O.each(["create", "get", "show", "hide", "remove"],
    function(p, f) {
        Tipped[f] = function() {
            return this
        }
    }), ai.create = function() {
        return []
    });
	*/
    O.extend(ab.prototype, {
        build: function() {
            if (!this.getState("build")) {
                O(document.body).append(O(this.container).css({
                    left: "-10000px",
                    top: "-10000px",
                    zIndex: this.zIndex
                }).append(O(this.skinElement = document.createElement("div")).addClass("t_Skin")).append(O(this.contentElement = document.createElement("div")).addClass("t_Content")));
                O(this.container).addClass("t_Tooltip_" + this.options.skin);
                if (this.options.hideOnClickOutside) {
                    O(this.element).addClass("t_hideOnClickOutside");
                    this.setEvent(document.documentElement, "click", O.proxy(function(f) {
                        if (this.visible()) {
                            f = O(f.target).closest(".t_Tooltip, .t_hideOnClickOutside")[0]; (!f || f && f != this.container && f != this.element) && this.hide()
                        }
                    },
                    this))
                }
                if (Tipped.support.cssTransitions && (this.options.fadeIn || this.options.fadeOut)) {
                    this.setFadeDuration(this.options.fadeIn);
                    O(this.container).addClass("t_hidden")
                }
                this.createPostBuildObservers();
                this.setState("build", true);
                aO.add(this)
            }
        },
        _preBuild: function() {
            O(this.container = document.createElement("div")).addClass("t_Tooltip");
            this.createPreBuildObservers()
        },
        _buildSkin: function() {
            this.build();
            var f = S.get(this.element);
            if (f) {
                f.build()
            } else {
                new i(this.element);
                this.setState("skinned", true)
            }
        },
        createPreBuildObservers: function() {
            this.setEvent(this.element, "mouseenter", this.setActive);
            this.setEvent(this.element, "mouseleave", O.proxy(function(p) {
                this.setIdle(p)
            },
            this));
            this.options.showOn && O.each(this.options.showOn, O.proxy(function(p, r) {
                var q = false;
                if (r == "click") {
                    this.options.hideOn && O.each(this.options.hideOn,
                    function(t, s) {
                        if (s.element == "self" && s.event == "click") {
                            q = true;
                            return false
                        }
                    });
                    this.setState("toggles", q)
                }
                this.setEvent(this.element, r, r == "click" ? q ? this.toggle: this.show: O.proxy(function() {
                    this.showDelayed()
                },
                this))
            },
            this));
            this.options.hideOn ? O.each(this.options.hideOn, O.proxy(function(p, r) {
                var q;
                switch (r.element) {
                case "self":
                    if (this.getState("toggles") && r.event == "click") {
                        return
                    }
                    q = this.element;
                    break;
                case "target":
                    q = this.target
                }
                q && this.setEvent(q, r.event, r.event == "click" ? this.hide: O.proxy(function() {
                    this.hideDelayed()
                },
                this))
            },
            this)) : this.options.showDelay && (this.options.showOn && !O.inArray("click", this.options.showOn) > -1) && this.setEvent(this.element, "mouseleave", O.proxy(function() {
                this.clearTimer("show")
            },
            this));
            var f = false;
            if (!this.options.fixed && this.options.showOn && ((f = O.inArray("mousemove", this.options.showOn) > -1) || O.inArray("touchmove", this.options.showOn) > -1) && this.target == "mouse") {
                this.setEvent(this.element, f ? "mousemove": "touchmove",
                function(p) {
                    this.getState("skinned") && this.position(p)
                })
            }
        },
        createPostBuildObservers: function() {
            this.setEvent(this.container, "mouseenter", this.setActive);
            this.setEvent(this.container, "mouseleave", this.setIdle);
            this.setEvent(this.container, "mouseenter", O.proxy(function() {
                this.getTimer("fadeTransition") || this.show()
            },
            this));
            this.options.hideOn && O.each(this.options.hideOn, O.proxy(function(p, f) {
                var q;
                switch (f.element) {
                case "tooltip":
                    q = this.container
                }
                q && this.setEvent(q, f.event, f.event.match(/^(click|mousemove|mouseenter)$/) ? this.hide: O.proxy(function() {
                    this.hideDelayed()
                },
                this))
            },
            this))
        },
        show: function(p) {
            this.clearTimer("hide");
            this.clearTimer("fadeTransition");
            if (!this.visible()) {
                if (O.type(this.content) == "function" || O.type(this._cache.contentFunction) == "function") {
                    if (O.type(this._cache.contentFunction) != "function") {
                        this._cache.contentFunction = this.content
                    }
                    var f = this._cache.contentFunction(this.element) || false;
                    if (f != this._cache.fnCallContent) {
                        this._cache.fnCallContent = f;
                        this.setState("updated", false);
                        this._restoreInlineContent()
                    }
                    this.content = f;
                    if (!f) {
                        return
                    }
                }
                this.options.hideOthers && aO.hideAll();
                this.setState("visible", true);
                this.options.ajax ? this.ajaxUpdate(p) : this.getState("updated") || this.update(this.content);
                this.getState("skinned") && this.position(p);
                this.raise();
                this.options.hideAfter && aM.defer(O.proxy(function() {
                    this.setActive()
                },
                this));
                if (O.type(this.options.onShow) == "function" && (!this.options.ajax || this.options.ajax && this.options.ajax.cache && this.getState("updated"))) {
                    this.options.onShow(this.contentElement.firstChild, this.element)
                }
                if (Tipped.support.cssTransitions && (this.options.fadeIn || this.options.fadeOut)) {
                    this.setFadeDuration(this.options.fadeIn);
                    O(this.container).addClass("t_visible").removeClass("t_hidden")
                }
                O(this.container).show()
            }
        },
        hide: function() {
            this.clearTimer("show");
            if (this.getState("visible")) {
                this.setState("visible", false);
                if (Tipped.support.cssTransitions && (this.options.fadeIn || this.options.fadeOut)) {
                    this.setFadeDuration(this.options.fadeOut);
                    O(this.container).removeClass("t_visible").addClass("t_hidden");
                    this.setTimer("fadeTransition", O.proxy(this._hide, this), this.options.fadeOut)
                } else {
                    this._hide()
                }
                if (this._cache.xhr) {
                    this._cache.xhr.abort();
                    this._cache.xhr = null;
                    this.setState("xhr", false)
                }
            }
        },
        _hide: function() {
            if (this.getState("build")) {
                O(this.container).css({
                    left: "-10000px",
                    top: "-10000px"
                });
                aO.resetZ();
                this.resetHookPosition();
                if (O.type(this.options.onHide) == "function" && !this.spinner) {
                    this.options.onHide(this.contentElement.firstChild, this.element)
                }
            }
        },
        toggle: function(f) {
            this[this.visible() ? "hide": "show"](f)
        },
        visible: function() {
            return this.getState("visible")
        },
        showDelayed: function(f) {
            this.clearTimer("hide");
            this.clearTimer("fadeTransition"); ! this.getState("visible") && !this.getTimer("show") && this.setTimer("show", O.proxy(function() {
                this.clearTimer("show");
                this.show(f)
            },
            this), this.options.showDelay || 1)
        },
        hideDelayed: function() {
            this.clearTimer("show"); ! this.getTimer("hide") && this.getState("visible") && this.setTimer("hide", O.proxy(function() {
                this.clearTimer("hide");
                this.clearTimer("fadeTransition");
                this.hide()
            },
            this), this.options.hideDelay || 1)
        },
        setFadeDuration: function(p) {
            if (Tipped.support.cssTransitions) {
                var p = p || 0,
                f = this.container.style;
                f.MozTransitionDuration = p + "ms";
                f.webkitTransitionDuration = p + "ms";
                f.OTransitionDuration = p + "ms";
                f.transitionDuration = p + "ms"
            }
        },
        setState: function(p, f) {
            this._cache.states[p] = f
        },
        getState: function(f) {
            return this._cache.states[f]
        },
        setActive: function() {
            this.setState("active", true);
            this.getState("visible") && this.raise();
            this.options.hideAfter && this.clearTimer("idle")
        },
        setIdle: function() {
            this.setState("active", false);
            this.options.hideAfter && this.setTimer("idle", O.proxy(function() {
                this.clearTimer("idle");
                this.getState("active") || this.hide()
            },
            this), this.options.hideAfter)
        },
        getTimer: function(f) {
            return this._cache.timers[f]
        },
        setTimer: function(p, f, q) {
            this._cache.timers[p] = aM.delay(f, q)
        },
        clearTimer: function(f) {
            if (this._cache.timers[f]) {
                window.clearTimeout(this._cache.timers[f]);
                delete this._cache.timers[f]
            }
        },
        clearTimers: function() {
            O.each(this._cache.timers,
            function(p, f) {
                window.clearTimeout(f)
            });
            this._cache.timers = []
        },
        setEvent: function(p, f, r, q) {
            r = O.proxy(r, q || this);
            this._cache.events.push({
                element: p,
                eventName: f,
                handler: r
            });
            O(p).bind(f, r)
        },
        clearEvents: function() {
            O.each(this._cache.events,
            function(p, f) {
                O(f.element).unbind(f.eventName, f.handler)
            })
        },
        setHookPosition: function(p) {
            var f = S.get(this.element);
            f && f.setHookPosition(p)
        },
        resetHookPosition: function() {
            this.setHookPosition(this.options.hook.tooltip)
        },
        refresh: function() {
            var f = S.get(this.element);
            if (f) {
                f.refresh();
                this.visible() && this.position()
            }
        },
        update: function(p, f) {
            var q = O.extend({
                afterUpdate: this.options.afterUpdate,
                spinner: false
            },
            f || {});
            this.build();
            this.getState("visible") && O(this.container).hide();
            aO.UpdateQueue.update(this, p, O.proxy(function() {
                var r = this.getState("visible");
                r || this.setState("visible", true);
                this._buildSkin();
                r || this.setState("visible", false);
                if (this.getState("visible")) {
                    O(this.container).hide();
                    this.position();
                    this.raise();
                    O(this.container).show()
                }
                this.setState("updated", true);
                q.afterUpdate && q.afterUpdate(this.contentElement.firstChild, this.element);
                q.callback && q.callback()
            },
            this), {
                spinner: q.spinner
            })
        },
        ajaxUpdate: function(f) {
            if (! (this.getState("xhr") || this.options.ajax.cache && this.getState("updated"))) {
                this.setState("xhr", true);
                if (this.options.spinner) {
                    if (this.spinner) {
                        this.spinner.play()
                    } else {
                        this.spinner = this.insertSpinner(this.options.spinner);
                        this.setState("updated", false)
                    }
                    this.position(f)
                }
                if (this._cache.xhr) {
                    this._cache.xhr.abort();
                    this._cache.xhr = null
                }
                this._cache.xhr = O.ajax({
                    url: this.content,
                    type: this.options.ajax.type,
                    data: this.options.ajax.data || {},
                    dataType: this.options.ajax.dataType || "html",
                    success: O.proxy(function(p, r, q) {
                        q.status !== 0 && this.update(q.responseText, {
                            spinner: this.options.spinner && this.spinner,
                            callback: O.proxy(function() {
                                this.setState("xhr", false);
                                if (this.getState("visible") && this.options.onShow) {
                                    this.options.onShow(this.contentElement.firstChild, this.element)
                                }
                                if (this.spinner) {
                                    this.spinner.remove();
                                    this.spinner = null
                                }
                            },
                            this)
                        })
                    },
                    this)
                })
            }
        },
        insertSpinner: function(p) {
            var f = document.createElement("div");
            O(f).data("isSpinner", true);
            var q = Spinners.create(f, O.extend({},
            p || {})),
            p = Spinners.getDimensions(f);
            O(f).css(aL(p));
            this.update(f, {
                afterUpdate: false,
                callback: function() {
                    q.play()
                }
            });
            return q
        },
        position: function(p) {
            if (this.visible()) {
                var f;
                if (this.options.target == "mouse") {
                    f = aO.Position.isPointerEvent(p);
                    var r = aO.Position.mouseBuffer;
                    if (f) {
                        if (r.x || r.y) {
                            this._cache.event = {
                                x: r.x,
                                y: r.y
                            };
                            f = null
                        } else {
                            f = p
                        }
                    } else {
                        if (r.x || r.y) {
                            this._cache.event = {
                                x: r.x,
                                y: r.y
                            }
                        } else {
                            if (!this._cache.event) {
                                f = aO.Position.getAbsoluteOffset(this.element);
                                this._cache.event = {
                                    x: f.left,
                                    y: f.top
                                }
                            }
                        }
                        f = null
                    }
                } else {
                    f = this.target
                }
                aO.Position.set(this, this.options.hook.tooltip, f, this.options.hook.target);
                if (p && aO.Position.isPointerEvent(p)) {
                    var r = O(this.container).outerWidth(),
                    q = O(this.container).outerHeight(),
                    p = aM.pointer(p);
                    f = aM.element.cumulativeOffset(this.container);
                    p.x >= f.left && p.x <= f.left + r && (p.y >= f.top && p.y <= f.top + q) && aM.defer(O.proxy(function() {
                        this.clearTimer("hide")
                    },
                    this))
                }
            }
        },
        raise: function() {
            if (this.getState("build") && !this.options.zIndex) {
                var f = aO.getHighestTooltip();
                if (f && f != this && this.zIndex <= f.zIndex) {
                    O(this.container).css({
                        zIndex: this.zIndex = f.zIndex + 1
                    })
                }
            }
        },
        _restoreInlineContent: function() {
            var f;
            if (this.inlineMarker && this.inlineContent) { (f = O(this.inlineContent).data("tipped_restore_inline_display")) && O(this.inlineContent).css({
                    display: f
                });
                O(this.inlineMarker).before(this.inlineContent).remove();
                this.inlineMarker = null
            }
        },
        remove: function() {
            aM.defer(O.proxy(function() {
                this.clearEvents()
            },
            this));
            this.clearTimers();
            this._restoreInlineContent();
            aM.defer(O.proxy(function() {
                O(this.container).find("img[src]").unbind("load")
            },
            this));
            S.remove(this.element);
            if (this.getState("build") && this.container) {
                O(this.container).remove();
                this.container = null
            }
            var f; (f = O(this.element).data("tipped_restore_title")) && O(this.element).attr("title", f).removeData("tipped_restore_title");
            O(this.element).removeData("tipped-uid")
        }
    });
    Tipped.init()
})(jQuery);